Dynamic query-time synonyms


(ddorian43) #1

I'm doing synonyms but for different reasons (many users in 1 index each with different synonyms) I need to handle synonyms only at query time. What is the best way to do this currently in es ?

Currently I'm thinking a process like:

  1. analyze query and get tokens from es without searching
  2. check tokens with other db for synonyms
  3. rebuild query to es with synonyms for the current tokens included

Does this make sense ? Am I missing something? How would I do step 3 ?

Thanks!


(Isabel Drost-Fromm) #2

You might want to checkout

https://www.elastic.co/guide/en/elasticsearch/guide/current/synonyms-expand-or-contract.html

To quote from the page linking to that: https://www.elastic.co/guide/en/elasticsearch/guide/current/synonyms-expand-or-contract.html

Alternatively, if we don’t use synonyms at index time, then at search time, we would need to convert a query for English into a query for english OR british.

As a side question: What's your reason for having multiple users in one index?

Hope this helps,
Isabel


(ddorian43) #3

@mainec
Because the number of users is big (at least thousands, hopefully low million) and I can't have that many indexes/shards because of the overhead.

I'll check it out and reply again if I still have questions.


(system) #4