# Related Searches

**URL:** <https://discuss.elastic.co/t/related-searches/9465>\
**Category:** Elasticsearch\
**Created:** [October 25, 2012, 3:18am UTC](https://discuss.elastic.co/t/related-searches/9465 "2012-10-25T03:18:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaron\_Rosenthal](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Aaron\_Rosenthal](https://discuss.elastic.co/u/Aaron_Rosenthal)\
**Post date:** [October 25, 2012, 3:18am UTC](https://discuss.elastic.co/t/related-searches/9465/1 "2012-10-25T03:18:56Z")

</div>

How is it best to offer our users related search suggestions based on  
related query. Does elastic have features like this built in our would re  
have to build our own. Any suggestions would be great. We are trying to  
plan this in our next release. Aaron

--

---

<div class="post-metadata">

**Author:** ![Chris\_Male](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_male/32/2607_2.png) [@Chris\_Male](https://discuss.elastic.co/u/Chris_Male)\
**Post date:** [October 25, 2012, 3:27am UTC](https://discuss.elastic.co/t/related-searches/9465/2 "2012-10-25T03:27:04Z")

</div>

Would something along the lines of MoreLikeThis (  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/mlt-query.html)) be  
sufficient? It can provide similar documents.

On Thursday, October 25, 2012 4:18:57 PM UTC+13, Aaron Rosenthal wrote:

> How is it best to offer our users related search suggestions based on  
> related query. Does elastic have features like this built in our would re  
> have to build our own. Any suggestions would be great. We are trying to  
> plan this in our next release. Aaron

--

---

<div class="post-metadata">

**Author:** ![Aaron\_Rosenthal](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Aaron\_Rosenthal](https://discuss.elastic.co/u/Aaron_Rosenthal)\
**Post date:** [October 25, 2012, 3:39am UTC](https://discuss.elastic.co/t/related-searches/9465/3 "2012-10-25T03:39:53Z")

</div>

I was thinking along the lines of like a typical ebay search.

keyword: server  
Related Searches: _home_ server[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=home+server&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=home+server&_frs=1),  
_dell_ server[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=dell+server&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=dell+server&_frs=1),  
server _rack_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+rack&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+rack&_frs=1),  
server _tower_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+tower&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+tower&_frs=1),  
server _quad core_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+quad+core&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+quad+core&_frs=1),  
_hp_ server [http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=hp+server&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=hp+server&_frs=1),  
server _2003_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+2003&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+2003&_frs=1),  
server_16gb ram_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+16gb+ram&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+16gb+ram&_frs=1),  
server _warmer_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+warmer&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+warmer&_frs=1)

--

---

<div class="post-metadata">

**Author:** ![Nick\_Dunn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_dunn/32/2315_2.png) [@Nick\_Dunn](https://discuss.elastic.co/u/Nick_Dunn)\
**Post date:** [October 25, 2012, 7:27am UTC](https://discuss.elastic.co/t/related-searches/9465/4 "2012-10-25T07:27:35Z")

</div>

ES doesn't log what people have searched for, so if you want to return a genuine list of related/popular searches that other users made, this logic would be in your own application.

I know the ES developers have yet to implement "did you mean" functionality because its going to be built in to Lucene 4 (ES uses Lucene 3?), and they didn't want to write it from scratch.

However you could potentially use a fuzzy match query against your index and set the result to return highlighted chunks of text, ie the words surrounding your term. It won't be perfect but might get you half way there.

Your best bet is to write your own logic — store each search term and the number of results it returns. Your "see also" list would be the distinct terms from this dataset, ordered either by their frequency (popularity) or number of results they yield (precision).

--

---

<div class="post-metadata">

**Author:** ![Nick\_Dunn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_dunn/32/2315_2.png) [@Nick\_Dunn](https://discuss.elastic.co/u/Nick_Dunn)\
**Post date:** [October 25, 2012, 7:30am UTC](https://discuss.elastic.co/t/related-searches/9465/5 "2012-10-25T07:30:31Z")

</div>

What I failed to say is that you could periodically push and aggregated form of this logged dataset (all distinct terms) back into your ES index, so that the terms can be retrieved with whatever type of ES query best suits (fuzzy, wildcard, exact term, stemmed etc).

--

---

<div class="post-metadata">

**Author:** ![Aaron\_Rosenthal](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Aaron\_Rosenthal](https://discuss.elastic.co/u/Aaron_Rosenthal)\
**Post date:** [October 25, 2012, 6:01pm UTC](https://discuss.elastic.co/t/related-searches/9465/6 "2012-10-25T18:01:29Z")

</div>

Thanks for your input we just didn't want to re-invent the wheel. -Aaron

On Thursday, October 25, 2012 12:30:31 AM UTC-7, Nick Dunn wrote:

> What I failed to say is that you could periodically push and aggregated  
> form of this logged dataset (all distinct terms) back into your ES index,  
> so that the terms can be retrieved with whatever type of ES query best  
> suits (fuzzy, wildcard, exact term, stemmed etc).

--

---

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [October 26, 2012, 5:48am UTC](https://discuss.elastic.co/t/related-searches/9465/7 "2012-10-26T05:48:30Z")

</div>

Hi Aaron,

We have something like that in a form of a Java library. It's not packaged  
or polished, but it does work, assuming you have a good sized query log.  
If you are interested, please get in touch - [http://sematext.com](http://sematext.com) and if  
there is strong interest we could polish and package this up.

## Otis

Search Analytics - [Cloud Monitoring Tools & Services | Sematext](http://sematext.com/search-analytics/index.html)  
Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)

On Wednesday, October 24, 2012 11:39:53 PM UTC-4, Aaron Rosenthal wrote:

> I was thinking along the lines of like a typical ebay search.
> 
> keyword: server  
> Related Searches: _home_ server[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=home+server&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=home+server&_frs=1),  
> _dell_ server[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=dell+server&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=dell+server&_frs=1),  
> server _rack_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+rack&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+rack&_frs=1),  
> server _tower_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+tower&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+tower&_frs=1),  
> server _quad core_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+quad+core&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+quad+core&_frs=1),  
> _hp_ server[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=hp+server&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=hp+server&_frs=1),  
> server _2003_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+2003&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+2003&_frs=1),  
> server_16gb ram_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+16gb+ram&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+16gb+ram&_frs=1),  
> server _warmer_[http://www.ebay.com/sch/i.html?\_sacat=0&\_nkw=server+warmer&\_frs=1](http://www.ebay.com/sch/i.html?_sacat=0&_nkw=server+warmer&_frs=1)

--

---

<div class="post-metadata">

**Author:** ![BillyEm](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@BillyEm](https://discuss.elastic.co/u/BillyEm)\
**Post date:** [October 29, 2012, 2:25am UTC](https://discuss.elastic.co/t/related-searches/9465/8 "2012-10-29T02:25:22Z")

</div>

Hey Nick:

What does precision defined as "or number of results they yield  
(precision)." come from. Its not the TREC definition. In fact the number of  
results is nothing but the number of results, without a relevance judge  
evaluating them.

re  
b

On Thursday, October 25, 2012 3:30:31 AM UTC-4, Nick Dunn wrote:

> What I failed to say is that you could periodically push and aggregated  
> form of this logged dataset (all distinct terms) back into your ES index,  
> so that the terms can be retrieved with whatever type of ES query best  
> suits (fuzzy, wildcard, exact term, stemmed etc).

--

---

<div class="post-metadata">

**Author:** ![Nick\_Dunn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_dunn/32/2315_2.png) [@Nick\_Dunn](https://discuss.elastic.co/u/Nick_Dunn)\
**Post date:** [October 31, 2012, 11:53pm UTC](https://discuss.elastic.co/t/related-searches/9465/9 "2012-10-31T23:53:41Z")

</div>

I think what I was trying to say was that storing the number of results in  
the log against the search term goes some way to allowing you to evaluate  
whether that search was successful and/or useful to the user. You could set  
a threshold and say that a search yielding 1-10 results is good, but any  
more then precision is poor. You could factor this into your algorithm to  
decide which "related" searches to display to the user, thereby filtering  
out the user searches that you deem unsuccessful.

In reality you'd want this to be more accurate and use other metrics,  
perhaps tracking the number of clicks from search results pages (implying  
accuracy), whether search term yielded a bounced visit (not good!) and so  
on.

On Thursday, October 25, 2012 4:18:57 AM UTC+1, Aaron Rosenthal wrote:

> How is it best to offer our users related search suggestions based on  
> related query. Does elastic have features like this built in our would re  
> have to build our own. Any suggestions would be great. We are trying to  
> plan this in our next release. Aaron

--

---

<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:** [July 6, 2017, 3:06am UTC](https://discuss.elastic.co/t/related-searches/9465/10 "2017-07-06T03:06:41Z")

</div>


