Extract routing value from document - bulk index

The documentation states " When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself"

How is the routing information represented in the document?
The _routing field cannot be used is it is a metadata field.

You can use a pipeline for this

PUT _ingest/pipeline/my-pipeline
{
  "processors": [
    {
      "script": {
        "lang": "painless",
        "source": "ctx._routing = ctx.key"
      }
    }
  ]
}

And then configure the index to always use that pipeline.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.