# Distinct Keywords Search Order

**URL:** <https://discuss.elastic.co/t/distinct-keywords-search-order/10727>\
**Category:** Elasticsearch\
**Created:** [February 13, 2013, 3:24pm UTC](https://discuss.elastic.co/t/distinct-keywords-search-order/10727 "2013-02-13T15:24:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kayngee](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@kayngee](https://discuss.elastic.co/u/kayngee)\
**Post date:** [February 13, 2013, 3:24pm UTC](https://discuss.elastic.co/t/distinct-keywords-search-order/10727/1 "2013-02-13T15:24:25Z")

</div>

Is it possible in elastic search to sort the search results by the distinct  
keyword I search for;

So if I searched for "boat","House" and "cat"

i want the results ordered by the records which first contain all 3  
keywords, then those which contain 2 keywords then those which contain a  
single keyword.

Regards  
Shawn

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![kayngee](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@kayngee](https://discuss.elastic.co/u/kayngee)\
**Post date:** [February 13, 2013, 3:48pm UTC](https://discuss.elastic.co/t/distinct-keywords-search-order/10727/2 "2013-02-13T15:48:23Z")

</div>

In other words i would like on the number of occurrence in the SHOULD  
clause of the query.

On Wednesday, 13 February 2013 16:24:25 UTC+1, Shawn Ritchie wrote:

> Is it possible in Elasticsearch to sort the search results by the  
> distinct keyword I search for;
> 
> So if I searched for "boat","House" and "cat"
> 
> i want the results ordered by the records which first contain all 3  
> keywords, then those which contain 2 keywords then those which contain a  
> single keyword.
> 
> Regards  
> Shawn

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:51am UTC](https://discuss.elastic.co/t/distinct-keywords-search-order/10727/3 "2017-07-06T02:51:39Z")

</div>

Closed on July 6, 2017, 2:51am UTC


