# Match with dynamic synonyms with Fasttext vectors

**URL:** <https://discuss.elastic.co/t/match-with-dynamic-synonyms-with-fasttext-vectors/290252>\
**Category:** Elasticsearch\
**Tags:** eql-elastic-query-language\
**Created:** [November 26, 2021, 8:10am UTC](https://discuss.elastic.co/t/match-with-dynamic-synonyms-with-fasttext-vectors/290252 "2021-11-26T08:10:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gevezex](https://avatars.discourse-cdn.com/v4/letter/g/a3d4f5/32.png) [@gevezex](https://discuss.elastic.co/u/gevezex)\
**Post date:** [November 26, 2021, 8:10am UTC](https://discuss.elastic.co/t/match-with-dynamic-synonyms-with-fasttext-vectors/290252/1 "2021-11-26T08:10:21Z")

</div>

In my backend application I want to catch the search keywords of a user and find all synonyms with fasttext before passing it to es. So the idea is as follow:

search terms of user: "couch fabric"

fasttext will return:  
couch: lounge, sofa, divan, settee, furniture  
fabric: material, textile, weave, stuff, structure

So now I can search with ES:  
( couch, lounge, sofa, divan, settee, furniture ) or (fabric, material, textile, weave, stuff, structure)

But the problem I encounter is that I want to give a higher ranking if there are matches for both of the term synonyms and lower ranking for multiple matches on only one term synonym, like this:

"this **divan**'s **material** s is of top quality"  
should have more ranking than  
"this **divan** is a kind of **sofa** where you can relax"

How can I do this?

PS: I don't want to work with ES synonyms files as this would create large files with a lot of synonyms as I don't know what the user will query beforehand.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 24, 2021, 8:10am UTC](https://discuss.elastic.co/t/match-with-dynamic-synonyms-with-fasttext-vectors/290252/2 "2021-12-24T08:10:53Z")

</div>

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