0
votes

In my application, I am using Elasticsearch for indexing and searching of documents.As expected, documents have some fields.

Due to new requirements, users want those documents to have some more new fields. I can add new fields for newly created documents, but I also need to have old documents too to have these fields.

I am thinking of writing a framework which would accept generic criteria to read old documents and update them. By generic criteria, I mean it must be able to accept any user defined condition to read older documents.

I am new to ES,and hence not sure if its feasible.

So I want to know whether it is feasible to write such a framework using Elastic search?

1

1 Answers

1
votes

If you provide a custom document id, you can reindex your existing data with the update api (available also in the upsert mode). In this way you can update the documents adding the new fields when you re-import the old data.

It is important to provide a document id, otherwise it is impossible to add fields to the existing documents, since only insert are possible.