# Order by most in common with array

**URL:** <https://discuss.elastic.co/t/order-by-most-in-common-with-array/148994>\
**Category:** Elasticsearch\
**Created:** [September 18, 2018, 2:21pm UTC](https://discuss.elastic.co/t/order-by-most-in-common-with-array/148994 "2018-09-18T14:21:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew-inamdar](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@matthew-inamdar](https://discuss.elastic.co/u/matthew-inamdar)\
**Post date:** [September 18, 2018, 2:21pm UTC](https://discuss.elastic.co/t/order-by-most-in-common-with-array/148994/1 "2018-09-18T14:21:19Z")

</div>

Hi everyone!

I have an index with documents that have a `keywords` field which stores string values (as an array).

When performing a search which includes a number of keywords that the document should have (only needs 1 to match), is there any way to order the results by the most keywords matched?

Cheers,  
Matt

---

<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:** [October 16, 2018, 2:21pm UTC](https://discuss.elastic.co/t/order-by-most-in-common-with-array/148994/2 "2018-10-16T14:21:22Z")

</div>

Closed on October 16, 2018, 2:21pm UTC

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