0
votes

I am working on a task of reindexing my Elastic search indexes in case any change happens. There are 2 ways that I can find to implement this but they look same to me unless I am missing something.

I am getting data to my Elastic search service from Postgres of service B, which has a paginated endpoint.

Approach 1:

  1. Create alias which will point to our existing index.
  2. When reindex is triggered, create a new index and once the reindexing is complete, point the alias, which was pointing to old index, to the newly created index.
  3. Delete the old index.

Approach 2:

  1. Create a new Index.
  2. Use the reindex API to copy the data from old index to new index, which will apply the new changes to the old documents.

To me, both of these look same. Disadvantage of using approach 2 seems that it will create a new index name, hence we will have to change the index names while querying.

Also, considering my reindexing operation would not be a frequent task, I am reading the data from a paginated endpoint and then creating indexes again, Approach 1 seems to make more sense to me.

1
Please read Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions.halfer

1 Answers

0
votes

In approach1, you are using alias. In approach 2, you are not using alias.

Both would be same if you add alias to approach2 as step3 and step4 - delete the old index.

Refer As you need to do little often.