How to dynamically change synonyms for ElasticSearch

后端 未结 5 1389
执念已碎
执念已碎 2021-02-06 05:22

My synonyms are stored in a database and, when the synonyms are changed in the database, I want to update any values in the index which may be changed as a result of the synonym

5条回答
  •  生来不讨喜
    2021-02-06 06:04

    It turns out that you can tell ElasticSearch programmatically that the synonyms have changed. That is, it is not necessary to update the synonym file. Here's the basic steps that are necessary:

    • Close the index.
    • Update the index settings with the new synonym list. To be safe, I am updating all of the analyzers, tokenizers and char filters for the index (not just the synonym filter) - but I am not sure that is necessary.
    • Open the index.

提交回复
热议问题