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}}"
      }
    }
  ]
}
1
  • Any solution for this? Commented Mar 7, 2022 at 15:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.