# Search with atmost n terms match

**URL:** <https://discuss.elastic.co/t/search-with-atmost-n-terms-match/22658>\
**Category:** Elasticsearch\
**Created:** [March 13, 2015, 4:59pm UTC](https://discuss.elastic.co/t/search-with-atmost-n-terms-match/22658 "2015-03-13T16:59:29Z")\
**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:** [March 13, 2015, 4:59pm UTC](https://discuss.elastic.co/t/search-with-atmost-n-terms-match/22658/1 "2015-03-13T16:59:29Z")

</div>

Hi:  
Like the condition on match Query that sets a minimum terms that Should  
match, is there a way to specify Most terms that should match.  
for example :  
matchQuery(field,value).minShouldMatch(n).maxShouldMatch(m)

I have a Signature property of a document that represents the top  
significant terms on the document(based on tfidf). This field is indexed  
in the search index.  
I want to get all documents that have a minimum overlap of 5 terms in this  
and a maximum overlap of 56 terms.  
Anything beyond 56 terms might indicate the two documents are too  
similar/duplicates/near duplicates.

I want to achieve this via search and not via reindexing of the  
content(production issues prevent from reindexing). Is there a way to do  
this ?

Thanks

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/bf25a2a2-c1a2-44ca-8fad-11f06d0ba791%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bf25a2a2-c1a2-44ca-8fad-11f06d0ba791%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:26am UTC](https://discuss.elastic.co/t/search-with-atmost-n-terms-match/22658/2 "2017-07-06T00:26:57Z")

</div>


