# textSearch for at most n words match

**URL:** <https://discuss.elastic.co/t/textsearch-for-at-most-n-words-match/20608>\
**Category:** Elasticsearch\
**Created:** [November 6, 2014, 2:40pm UTC](https://discuss.elastic.co/t/textsearch-for-at-most-n-words-match/20608 "2014-11-06T14:40:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramdev\_Wudali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramdev_wudali/32/7894_2.png) [@Ramdev\_Wudali](https://discuss.elastic.co/u/Ramdev_Wudali)\
**Post date:** [November 6, 2014, 2:40pm UTC](https://discuss.elastic.co/t/textsearch-for-at-most-n-words-match/20608/1 "2014-11-06T14:40:35Z")

</div>

I have a document signature indexed (the top 60 most significant terms in  
the document) in an ES index, along with a document ID. I would like to  
retrieve documents that match at least 3 words in a query string, in the  
document signature field. Is it possible to limit search results that  
satisfy this condition (or at least 3 words matching). and if possible sort  
the results with the most matches ranking higher.

The field is a straightforward String field so a text match would work, But  
it would also return documents that have 1 word in common.(I only want  
documents that have at least 3 words in common).

Thanks for the assist.

Ramdev

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a3711f9e-e3ca-4a73-bd97-112023bbf572%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a3711f9e-e3ca-4a73-bd97-112023bbf572%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:51am UTC](https://discuss.elastic.co/t/textsearch-for-at-most-n-words-match/20608/2 "2017-07-06T00:51:49Z")

</div>


