Getting multi-word synonyms used in the search for display

I am developing a search system using Elasticsearch. In this system, users can register synonyms.
When performing a search, in addition to the return of the documents, it is also necessary to display which of the synonyms were used in the search.
I am currently running a separate query using Analyze to get this list of synonyms.
The problem is that there are cases where there are several multi-word synonyms and the return, by tokens, makes it difficult to obtain the data for display.
I tried to create an Analyzer using the keyword Tokenizer, but it only needs the synonym as a search term, which does not happen in a real search.

Any suggestions as to what would be the best approach to this problem?
Thanks.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.