# Only return with minimum hit count

**URL:** <https://discuss.elastic.co/t/only-return-with-minimum-hit-count/20894>\
**Category:** Elasticsearch\
**Created:** [November 21, 2014, 10:53pm UTC](https://discuss.elastic.co/t/only-return-with-minimum-hit-count/20894 "2014-11-21T22:53:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephen\_Ziegler](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Stephen\_Ziegler](https://discuss.elastic.co/u/Stephen_Ziegler)\
**Post date:** [November 21, 2014, 10:53pm UTC](https://discuss.elastic.co/t/only-return-with-minimum-hit-count/20894/1 "2014-11-21T22:53:48Z")

</div>

I'm playing around with a poor man's classifier using a boolean query that  
checks various term or phrase clauses. It currently has a  
minimum\_should\_match of 3 which I think means documents will only be  
returned if 3+ of my 10 clauses have matches. Is there a way to also limit  
it to documents that have a minimum match frequency? Like return documents  
that have 50+ matches across the 10 clauses within the document.

{  
"query": {  
"bool": {

```
  "should": [
              { "match": { "nugget_classify": "geographic" }},
              { "match": { "nugget_classify": "spatial" }},
              { "match": { "nugget_classify": "esri " }},
              { "match": { "nugget_classify": "ArcGIS " }},
              { "match": { "nugget_classify": "ArcGISOnline " }},
              { "match": { "nugget_classify": "PostGIS " }},
              { "match": { "nugget_classify": "leaflet" }},
              { "match_phrase": { "nugget": "geographic information" }},
              { "match_phrase": { "nugget": "web map" }},
              { "match_phrase": { "nugget": "web mapping" }}

        ],
        "minimum_should_match" : "3"
}

```

},  
"highlight" : {  
"pre\_tags" : ["**"],  
"post\_tags" : ["**"],  
"fields" : {  
"nugget" : {"fragment\_size" : 50, "number\_of\_fragments" : 3}

```
      }
},
"fields" : ["name"]

```

}

--  
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/d48b0d99-3637-4a90-b874-e4c1ee1182d5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d48b0d99-3637-4a90-b874-e4c1ee1182d5%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:48am UTC](https://discuss.elastic.co/t/only-return-with-minimum-hit-count/20894/2 "2017-07-06T00:48:22Z")

</div>


