# Customer Interest Related Keyword search in Elastic Search

**URL:** <https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116>\
**Category:** Elasticsearch\
**Created:** [June 1, 2020, 6:24am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116 "2020-06-01T06:24:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 1, 2020, 6:24am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/1 "2020-06-01T06:24:29Z")

</div>

How to create Customer Interest Related Keyword search in Elastic Search?  
Like "Laptop" keyword  
Then Laptops should display first, not Laptop Bags first, not laptop stand, and other, these should display in last

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 1, 2020, 10:48am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/2 "2020-06-01T10:48:28Z")

</div>

There's two main approaches:

1. [Promote](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-pinned-query.html) the primary products
2. [Demote](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-boosting-query.html) the products that are accessories (cases, cables etc).

Using aggregations to offer filters e.g by department, category price etc is also useful.

---

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 2, 2020, 9:04am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/3 "2020-06-02T09:04:57Z")

</div>

Still, i am not getting results for customers most related keywords products

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 2, 2020, 9:32am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/4 "2020-06-02T09:32:58Z")

</div>

Did you look at the links I shared?

---

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 2, 2020, 10:02am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/5 "2020-06-02T10:02:48Z")

</div>

Yes, i have tried both solutions on large eCommerce database, it is not working properly

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 2, 2020, 10:04am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/6 "2020-06-02T10:04:43Z")

</div>

Is this something that needs [raising as a bug](https://github.com/elastic/elasticsearch/issues/new/choose)?

---

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 2, 2020, 10:23am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/7 "2020-06-02T10:23:46Z")

</div>

yes, customers interest, most related keywords products, is mandatory for ecommerce, otherwise, it lacks the customers interest, if customer not finds interest related products, first

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 2, 2020, 10:33am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/8 "2020-06-02T10:33:55Z")

</div>

> [@Sagar\_jain](#):
>
> it is not working properly

Specifically, what is "not working properly" about the features I linked to?

---

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 2, 2020, 10:43am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/9 "2020-06-02T10:43:40Z")

</div>

From your suggestions and links, i am not getting results related to keywords,  
Like "Laptop" keyword  
Then Laptops should display first, not Laptop Bags first, not laptop stand, and other, these should display in last  
I am getting same results from your solution links, as you suggest

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 2, 2020, 10:51am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/10 "2020-06-02T10:51:15Z")

</div>

My suggestions may be too low-level for you - they would involve development of custom application logic using these APIs to manage the set of promotions or demotions associated with particular search terms.  
If you're looking for a code-free solution to tuning relevance then I suggest you take a look at our [app-search](https://www.elastic.co/app-search/) product and, in particular, its ability to [curate](https://www.elastic.co/guide/en/app-search/current/curations-guide.html) search results.

---

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 2, 2020, 11:40am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/11 "2020-06-02T11:40:00Z")

</div>

I need a code solution, using any elastic search api  
If you have any code solution or any api, so please suggest me

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 2, 2020, 1:05pm UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/12 "2020-06-02T13:05:01Z")

</div>

You probably need to pre-process certain searches before sending them to elasticsearch.

One approach is to write application code to map trigger search terms people type (like "laptop") to one of the 2 API calls I listed (those that promote laptops or demote laptop cases). Your code should also spot the exceptions to this rule in the search input (the keywords "case" or "cover").  
You can machine-learn the set of trigger keywords by searching an index of product descriptions or query click logs. Use the `significant_text` aggregation to find the significant words connected to "case" or "cover". These are the trigger words I found from the (dated) BestBuy click logs for searches containing "cover":

```
 ipad, ipad2, iphone, ipod, keyboard, kindle, laptop, macbook, nook, phone, tablet, xoom

```

If you're starting out on this relevance tuning journey I'd recommend [this book](https://www.amazon.co.uk/Relevant-Search-Mr-Doug-Turnbull/dp/161729277X).

---

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 2, 2020, 1:09pm UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/13 "2020-06-02T13:09:45Z")

</div>

But the preprocess will make search slower.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 2, 2020, 1:13pm UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/14 "2020-06-02T13:13:06Z")

</div>

Not really. Looking up search terms in a hashmap of trigger keywords will be negligible.

---

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 10, 2020, 7:38am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/15 "2020-06-10T07:38:19Z")

</div>

KEYWORD|ISSUE|  
|sanatizers|Misspelled Keyword giving null results.|  
Improper results shows on keywords

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 10, 2020, 7:52am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/16 "2020-06-10T07:52:01Z")

</div>

Sorry I don’t understand

---

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 10, 2020, 8:25am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/17 "2020-06-10T08:25:23Z")

</div>

For eg.  
wrong keyword spelling - sanatizers,  
correct keyword spelling - sanitizers,  
[  
'query'=\>[  
//'dfs\_query\_then\_fetch' =\> true,  
'query\_string'=\>[  
'fields'=\>['name'],  
'lenient'=\>true,  
'query'=\>'sanatizers',  
]  
]  
]

|Misspelled Keyword giving null results.|

---

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 10, 2020, 8:44am UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/18 "2020-06-10T08:44:03Z")

</div>

IS elastic search checks wrong keywords spelling?

---

<div class="post-metadata">

**Author:** ![Sagar\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_jain/32/46276_2.png) [@Sagar\_jain](https://discuss.elastic.co/u/Sagar_jain)\
**Post date:** [June 23, 2020, 12:24pm UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/19 "2020-06-23T12:24:03Z")

</div>

Is ELASTIC SEARCH, does not give same results on plural keywords

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 23, 2020, 12:37pm UTC](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116/20 "2020-06-23T12:37:53Z")

</div>

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script is something anyone can copy and paste in Kibana dev console, click on the run button to reproduce your use case. It will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

[Next page](https://discuss.elastic.co/t/customer-interest-related-keyword-search-in-elastic-search/235116.md?page=2)
