Add a new field to all index in ElasticSearch


We are using Elastic Search 2.2 . We are in a need to add a new field to all the elastic search indices. Currently we create a new index each day. So need to add the specified field to all the documents in each index. So is there any way by which this can be done.

Hi @iaskdoubt,

Is it for the new documents or also the old data?
How do you create your actual document?

also for the old documents

If it's also for old documents you need to use a script to update all your old documents one by one.

A better way is if you upgrade to a new version you can reindex your data to the new version and add an ingest that will add the new field and value.

How do you create your actual documents?
If you can give more details on the numbers of documents, number of index and any other useful detail it may help to provide a better solution.