2

I am using Elasticsearch v7.9 and need to get index name during ingest instead of alias name.

Alias name = employees_prod and Index Name = employees

POST /employees_prod/_doc?pipeline=test-pipeline&refresh
{
  "name": "Quick Brown Fox",
  "created_date": "2021-04-12T19:45:19Z"
}

When I pass alias name for document creation as above, I get alias name when using ingestDocument.getSourceAndMetadata().get("_index") during ingest in elasticsearch ingest plugin.

Is there a way to get index name instead of alias name?

I have tried to set dynamic value in pipeline as below to get the index name. But it doesn't work for me.

PUT /_ingest/pipeline/test-pipeline
{
  "description": "ES pipeline",
  "processors": [
    {
      "test_ingest_processor": {
        "field": [
          "test_type:test_key",
        ]
      },
     "set": {
        "description": "Set Index value",
        "field": "_index",
        "value": "{{_index}}"
      }
    }
  ]
}
Galet
  • 5,853
  • 21
  • 82
  • 148

0 Answers0