Should I reimport data after updating synonyms file

Hi All,

I was wondering, If I update the synonyms files, do I need to reload the data into ES?
Because I have tried to only restart ES after updating synonyms files, but it does not work.
If it is so, do you have any more efficient solution, since reloading data is quite frustrated..

1 Like

You need to restart all nodes.
And you need to reindex.

Synonyms are applied at index time and at query time as well to parse your text.
If you don't reindex you might have unpredictable results.

2 Likes

Synonyms can be used to expand or contract.
expand: jump becomes skip and hop too
contract: jump and skip are normalized to hop.

In the case of expansions you need only apply the synonym analyzer to the docs at index time or the queries at query time.
Index-time expansion = faster queries but requires reindexing when synonyms change
Query-time expansion = slower queries and no need to reindex when synonyms change

For contraction use cases the queries and indexed docs both need to be in agreement in what to normalize words to and so changes to synonyms require a reindex.

1 Like

Thanks! Got it.

I might reindex them periodically,
but one thing is, I might require the query time synonyms come into force once the synonyms file is edited in real time.
So my question is: Can I achieve query time synonyms update by other method and not restarting all nodes? Since restarting may cost quite a time (during which the system is not working) which is not desired.
Do you have any idea on this?

OIf synonyms are on a file, then you need to restart.
If you defined synonyms using the REST API, then I think that you don't have to restart (but I never tried it).

Understood. Thanks for your answer and patience! :slight_smile: