# App Search Synonyms performance impact

**URL:** https://discuss.elastic.co/t/app-search-synonyms-performance-impact/355791
**Category:** Elastic Search
**Tags:** elastic-app-search
**Created:** [March 20, 2024, 8:24am UTC](https://discuss.elastic.co/t/app-search-synonyms-performance-impact/355791 "2024-03-20T08:24:54Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discuss.elastic.co/u/Chenko)
#### Post date: [March 20, 2024, 8:24am UTC](https://discuss.elastic.co/t/app-search-synonyms-performance-impact/355791/1 "2024-03-20T08:24:54Z")

</div>

Hi,

I saw that there is a default limit of 256 synonyms with 32 terms per set. However this could be increased.  
I was wondering where the limits are and more importantly what kind of impact this will have on App Search's performance.

What would the maximum be that we can increase this to ?  
What would the performance impact be for lets say 1.000 synonyms, or even 40.000 synonyms?  
Is this doable?

Thanks,  
Chenko

---

<div class="post-metadata">

### Author: ![ioana.tagirta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ioana.tagirta/32/46368_2.png) [@ioana.tagirta](https://discuss.elastic.co/u/ioana.tagirta)
#### Post date: [March 20, 2024, 9:23am UTC](https://discuss.elastic.co/t/app-search-synonyms-performance-impact/355791/2 "2024-03-20T09:23:10Z")

</div>

Hi,

There will definitely be a performance impact when increasing the number of synonyms in App Search.  
However there is another way!  
You could potentially look at Elasticsearch synonyms:

> **[Search with synonyms | Elasticsearch Guide \[8.12\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-with-synonyms.html)**

Recently Elasticsearch synonyms have become easier to manage since we now have an API to do so.  
You could potentially create your synonym set in Elasticsearch and define your Elasticsearch index that uses the synonym set for text fields. Then using this index, you can create an Elasticsearch based engine in App Search.

I do have to ask out of curiosity, what is the use case to create so many synonym sets?

---

<div class="post-metadata">

### Author: ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discuss.elastic.co/u/Chenko)
#### Post date: [March 20, 2024, 9:42am UTC](https://discuss.elastic.co/t/app-search-synonyms-performance-impact/355791/3 "2024-03-20T09:42:32Z")

</div>

Hi,

Yes I love that the Synonyms API has been added however our use case is that the client currently has alot of synonyms in their Elasticsearch. However they want to switch to App Search for its beautiful GUI and the ability to edit synonyms, currations and relevance tune through the GUI.

So unfortunately that wont work, unless I can use this with App Search?  
say when using an elasticsearch index based engine? However not using the `elasticsearch/_search` endpoint, while still using the `/search` endpoint.

Would that be possible?

Otherwise what kind of performance impact are we talking about?

Thanks for the quick response btw 🙂

---

<div class="post-metadata">

### Author: ![ioana.tagirta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ioana.tagirta/32/46368_2.png) [@ioana.tagirta](https://discuss.elastic.co/u/ioana.tagirta)
#### Post date: [March 20, 2024, 11:29am UTC](https://discuss.elastic.co/t/app-search-synonyms-performance-impact/355791/4 "2024-03-20T11:29:00Z")

</div>

You can use this Elasticsearch index with App Search /search endpoint if you create an Elasticsearch index engine: [Elasticsearch index engines | App Search documentation [8.12] | Elastic](https://www.elastic.co/guide/en/app-search/current/elasticsearch-engines.html)

You can still define synonyms for this engine in App Search - however this are App Search synonyms - they have a different implementation from Elasticsearch synonyms.  
Other features that you mentioned like curations or relevance tuning are also available.

However there are some limitations with Elasticsearch index Engines - the linked docs from above should include them - for example you cannot use the App Search Documents API.

In terms of the performance impact with synonyms - Elasticsearch synonyms would perform much better, because they work at a lower level (they are part of the index analyzers).  
The way App Search synonyms work is that at query time we retrieve the synonyms set from an internal, system index and decide which synonyms apply to the query string. Then App Search includes the synonyms in the generated Elasticsearch query it uses to retrieve results.  
The part that has a performance impact is retrieving the synonyms set - we haven't optimised that so that we only retrieve from Elasticsearch the minimum set of synonyms that can match the query string.  
So the more synonyms sets there are in App Search, the bigger the impact at query time.

Hope this makes sense, even if goes into the implementation details of App Search.

Also just as a note, while I haven't tested this closely, I think we can expect that App Search and Elasticsearch synonyms to behave differently - because they are different implementations.

Based on this thread, we will make a note however on the need to have an Elasticsearch synonyms UI in Kibana.

---

<div class="post-metadata">

### Author: ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discuss.elastic.co/u/Chenko)
#### Post date: [March 20, 2024, 12:00pm UTC](https://discuss.elastic.co/t/app-search-synonyms-performance-impact/355791/5 "2024-03-20T12:00:22Z")

</div>

> [@ioana.tagirta](#):
>
> You can use this Elasticsearch index with App Search /search endpoint if you create an Elasticsearch index engine: [Elasticsearch index engines | App Search documentation [8.12] | Elastic](https://www.elastic.co/guide/en/app-search/current/elasticsearch-engines.html)

Yes that is what we are currently doing.

> [@ioana.tagirta](#):
>
> You can still define synonyms for this engine in App Search - however this are App Search synonyms - they have a different implementation from Elasticsearch synonyms.  
> Other features that you mentioned like curations or relevance tuning are also available.

Okay got it.

> [@ioana.tagirta](#):
>
> However there are some limitations with Elasticsearch index Engines - the linked docs from above should include them - for example you cannot use the App Search Documents API.

Could you explain what you mean with this?

> [@ioana.tagirta](#):
>
> In terms of the performance impact with synonyms - Elasticsearch synonyms would perform much better, because they work at a lower level (they are part of the index analyzers).

Got it, unfortunately that won't be possible for our use case as we need to go from normal Elasticsearch to App Search.

> [@ioana.tagirta](#):
>
> The part that has a performance impact is retrieving the synonyms set - we haven't optimised that so that we only retrieve from Elasticsearch the minimum set of synonyms that can match the query string.  
> So the more synonyms sets there are in App Search, the bigger the impact at query time.

Got it, do you have some "numbers" for this. how drastic the impact is?

> [@ioana.tagirta](#):
>
> Based on this thread, we will make a note however on the need to have an Elasticsearch synonyms UI in Kibana.

That would be interesting.

---

<div class="post-metadata">

### Author: ![ioana.tagirta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ioana.tagirta/32/46368_2.png) [@ioana.tagirta](https://discuss.elastic.co/u/ioana.tagirta)
#### Post date: [March 20, 2024, 3:54pm UTC](https://discuss.elastic.co/t/app-search-synonyms-performance-impact/355791/6 "2024-03-20T15:54:33Z")

</div>

> [@ioana.tagirta](#):
>
> However there are some limitations with Elasticsearch index Engines - the linked docs from above should include them - for example you cannot use the App Search Documents API.

> Could you explain what you mean with this?

Yes, the documentation lists all the differences between App Search managed engines and Elasticsearch index engines in [Elasticsearch index engines | App Search documentation [8.12] | Elastic](https://www.elastic.co/guide/en/app-search/current/elasticsearch-engines.html)  
As an example, for the Elasticsearch index engines it is not possible to use the App Search Documents API to index/modify documents. To add documents to an Elasticsearch index engine, you actually have to use the Elasticsearch documents API and index documents directly in the index.

> So the more synonyms sets there are in App Search, the bigger the impact at query time.

> Got it, do you have some "numbers" for this. how drastic the impact is?

Unfortunately I don't have any numbers, but I do know this comes up as one of the causes for performance issues in App Search. If you notice this too, let us know.

---

<div class="post-metadata">

### Author: ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discuss.elastic.co/u/Chenko)
#### Post date: [March 20, 2024, 4:09pm UTC](https://discuss.elastic.co/t/app-search-synonyms-performance-impact/355791/7 "2024-03-20T16:09:14Z")

</div>

> [@ioana.tagirta](#):
>
> Yes, the documentation lists all the differences between App Search managed engines and Elasticsearch index engines in [Elasticsearch index engines | App Search documentation [8.12] | Elastic](https://www.elastic.co/guide/en/app-search/current/elasticsearch-engines.html)  
> As an example, for the Elasticsearch index engines it is not possible to use the App Search Documents API to index/modify documents. To add documents to an Elasticsearch index engine, you actually have to use the Elasticsearch documents API and index documents directly in the index.

Thanks, I misunderstood you the first time, thanks for clearing that up.

> [@ioana.tagirta](#):
>
> Unfortunately I don't have any numbers, but I do know this comes up as one of the causes for performance issues in App Search. If you notice this too, let us know.

Thats unfortunate.

@ioana.tagirta Thanks for the responses, since this issue has not been solved yet I will keep the solution empty.

---

<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: [April 17, 2024, 4:09pm UTC](https://discuss.elastic.co/t/app-search-synonyms-performance-impact/355791/8 "2024-04-17T16:09:34Z")

</div>

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