# Elasticsearch synonym search not working locally

**URL:** <https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952>\
**Category:** Questions\
**Tags:** litium-7\
**Created:** [March 23, 2021, 7:19am UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952 "2021-03-23T07:19:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishnu\_kj](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/vishnu_kj/32/685_2.png) [@vishnu\_kj](https://forum.litium.com/u/vishnu_kj)\
**Post date:** [March 23, 2021, 7:19am UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952/1 "2021-03-23T07:19:27Z")

</div>

I am trying to configure Elasticsearch using docker in my litium Project locally.  
The normal search is working fine, but I am not able to search with synonyms that I added in the litium backoffice

1. Docker and all nodes are up and running
2. Elasticsearch connectionString is added:  
 ![Connectionstring Added 2021-03-23 111859](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/576b194e068af31b85c6650b1225ad0ac14b5936.png)
3. Lucene indexing disabled for website and PIM and prefix added  
 ![Appsettings Added 2021-03-23 111800](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/82ec81f814093ed28de62e93dfe155cb50529570.png)
4. Synonyms added at back office  
 ![Synonyms Added 2021-03-23 111704](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/86ea1b2a24bf49f9cf5398f22a8750a0facddee9.png)
5. Index Build  
 ![index build 2021-03-23 111518](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/e3e6353622710f1cf29febdf959e54f4d86fdd02.png)
6. And I am able to see the synonyms added at back office on synonym\_path  
 ![Index details with synonyms path 2021-03-23 112658](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/262a3eb05b8f829a432c8976537c06740a37296f.png) ![listing Synonyms adde at Backoffice 2021-03-23 112851](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/38852b4179aa1d0cafb1daed0e39c26e76425f2c.png)

Did I miss something? I am not able to see result searched based on synonym.

Litium version: _[7.6.1]_

---

<div class="post-metadata">

**Author:** ![vishnu\_kj](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/vishnu_kj/32/685_2.png) [@vishnu\_kj](https://forum.litium.com/u/vishnu_kj)\
**Post date:** [March 26, 2021, 11:14am UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952/2 "2021-03-26T11:14:37Z")

</div>

Can anyone have a look into this and reply me what i am doing wrong

---

<div class="post-metadata">

**Author:** ![marten](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/marten/32/11_2.png) [@marten](https://forum.litium.com/u/marten)\
**Post date:** [March 30, 2021, 6:52am UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952/3 "2021-03-30T06:52:49Z")

</div>

Do you get any errors in the log that synonyms are not available from Elastic?

Do you have any other languages than swedish?

---

<div class="post-metadata">

**Author:** ![vishnu\_kj](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/vishnu_kj/32/685_2.png) [@vishnu\_kj](https://forum.litium.com/u/vishnu_kj)\
**Post date:** [March 30, 2021, 7:05am UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952/4 "2021-03-30T07:05:34Z")

</div>

Don’t have any errors in log,  
yes we have other languages than Swedish (Finnish, Norwegian, English) .

---

<div class="post-metadata">

**Author:** ![marten](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/marten/32/11_2.png) [@marten](https://forum.litium.com/u/marten)\
**Post date:** [March 30, 2021, 7:11am UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952/5 "2021-03-30T07:11:55Z")

</div>

Have you tried adding synonyms in those languages also?

You should be getting an error if the synonyms cannot be reached from elastic so not sure what the issue is.

What search phrase do you use and what is your expected result?  
`abc => arm071,abc` - this means that a search for _abc_ will also include searchresults of a search for _arm071_, so if you search for _arm071_ now, do you get hits?

---

<div class="post-metadata">

**Author:** ![vishnu\_kj](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/vishnu_kj/32/685_2.png) [@vishnu\_kj](https://forum.litium.com/u/vishnu_kj)\
**Post date:** [April 7, 2021, 8:42am UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952/6 "2021-04-07T08:42:33Z")

</div>

Thank you @marten, it worked now i am able to get hit.  
but the issue is, it only get hits when the keyword contains the part of Synonym.  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/9c907fef2599f8e10350f86ac839c219005efd9b.png)

here if i search with **abc** or **am7** I am not getting a hit. It works only when keywords are like **arm, 071 , m07**. Also I tried with other products. How am i able to search with keywords other than part of synonym?

---

<div class="post-metadata">

**Author:** ![ton.nguyen](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ton.nguyen/32/989_2.png) [@ton.nguyen](https://forum.litium.com/u/ton.nguyen)\
**Post date:** [April 7, 2021, 12:51pm UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952/7 "2021-04-07T12:51:50Z")

</div>

Can you try to setup keywords that have more than 3 characters?

---

<div class="post-metadata">

**Author:** ![vishnu\_kj](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/vishnu_kj/32/685_2.png) [@vishnu\_kj](https://forum.litium.com/u/vishnu_kj)\
**Post date:** [April 8, 2021, 4:38am UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952/8 "2021-04-08T04:38:01Z")

</div>

Yes it works if the Keyword contains any part of the Synonym eg : “ **arm 071** ” with space is also working

---

<div class="post-metadata">

**Author:** ![marten](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/marten/32/11_2.png) [@marten](https://forum.litium.com/u/marten)\
**Post date:** [April 9, 2021, 2:04pm UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952/9 "2021-04-09T14:04:10Z")

</div>

Guessing that the reason that you get hits on parts of synonyms is that you are actually searching values on the product?

But I am not able to reproduce the issue, I tested with the steps below and was able to add **abc** as a synonym for **arm071** :

1. Adding “ **arm071** ” to a product description  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/10c85cacee5ce1f47a5b48c363fb52fe557c6944.png)
2. Verify search works for “ **arm071** ”  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/94d53b07616295edfd432307e646db1a93c85807.png)
3. Add synonym  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/a1afc03f151afd057fcf0b41b29198f0c46d8aef.png)
4. Search for “ **abc** ” now give a hit for the arm071-product  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/1d85f18a1e33573bcaf33a64e02d4366edde7e51.png)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [May 7, 2021, 2:05pm UTC](https://forum.litium.com/t/elasticsearch-synonym-search-not-working-locally/1952/10 "2021-05-07T14:05:02Z")

</div>

Closed on May 7, 2021, 2:05pm UTC

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