Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch: After update index analyzer, index need a reindex?

If i update index analyzer like synonyms or keywords, i need to reindex the documents?

I notice some strange search result after analyzer update.

like image 851
ar099968 Avatar asked Oct 23 '25 18:10

ar099968


2 Answers

The answer is yes. You need all your data to be indexed in the same way. This could be the reason for getting "strange" results. The data that was already indexed was indexed according to the rules of the previously defined analyzers. Any data you index after changing the analyzers is indexed by the new rules.

And since your query also now gets analyzed by the new rules, it might not produce results from the old indexed data set. You can easily reindex data now through the elastic reindex api. Read: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html If you are concerned about Down-time, then you can read: https://www.elastic.co/blog/changing-mapping-with-zero-downtime

You can create a new index (index_name_v1) with the desired settings that you want. Next you can use the reindex API:

POST /_reindex
{
  "source": {
    "index": "old_index"
  },
  "dest": {
    "index": "index_name_v1"
  }
}
like image 145
Archit Saxena Avatar answered Oct 26 '25 14:10

Archit Saxena


That is correct. Previously indexed data will not reflect the changes as per paragraph 1 here.

like image 32
logan rakai Avatar answered Oct 26 '25 14:10

logan rakai