Home > Enterprise >  Elasticsearch Python apply multiple pipelines
Elasticsearch Python apply multiple pipelines

Time:11-19

I have two different pipelines that exist within my elasticsearch index, has_pls and has_age. I know it is possible to apply a pipeline to incoming documents using a string, like so es.create(index=index, id=ID, body=body, pipeline="has_pls").

I am looking into applying both pipelines to the incoming documents, but looking at the documentation, https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html, it seems like the create api only takes a string and expects a single pipeline. While I can merge the two pipeline scripts into one, I was wondering if it's possible to just apply the two pipelines at the same time, like soes.create(index=index, id=ID, body=body, pipeline=["has_pls", "has_age"]).

CodePudding user response:

What you can do is to create a pipeline that references both pipeline

PUT _ingest/pipeline/main-pipeline
{
  "processors" : [
    {
      "pipeline" : {
        "name": "has_pls"
      }
    },
    {
      "pipeline" : {
        "name": "has_age"
      }
    }
  ]
}

And then you can reference it like this:

es.create(index=index, id=ID, body=body, pipeline="main-pipeline").
  • Related