# Min\_score on filtered query?

**URL:** <https://discuss.elastic.co/t/min-score-on-filtered-query/8355>\
**Category:** Elasticsearch\
**Created:** [July 9, 2012, 9:30am UTC](https://discuss.elastic.co/t/min-score-on-filtered-query/8355 "2012-07-09T09:30:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcus](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@marcus](https://discuss.elastic.co/u/marcus)\
**Post date:** [July 9, 2012, 9:30am UTC](https://discuss.elastic.co/t/min-score-on-filtered-query/8355/1 "2012-07-09T09:30:30Z")

</div>

Hi,

Is it possible to use a min\_query within a filtered query. So not on the whole query object itself, but on the query within the filtered query. I've tried it, but only get error. This is an example of the code I'm using to do the query:

> <https://gist.github.com/anonymous/3075320>

Am I doing anything wrong or is this not supposed to work?

Thanks

---

<div class="post-metadata">

**Author:** ![Colin\_Dellow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colin_dellow/32/2818_2.png) [@Colin\_Dellow](https://discuss.elastic.co/u/Colin_Dellow)\
**Post date:** [July 10, 2012, 3:28pm UTC](https://discuss.elastic.co/t/min-score-on-filtered-query/8355/2 "2012-07-10T15:28:39Z")

</div>

I don't think it's meant to work -- min\_score is defined on the Search API,  
not the query DSL. I'm interested in this capability, too.

A workaround might be to use custom\_score as a poor man's filter -- at each  
point where you want to do a min\_score, wrap a custom score that sets score  
to 0 if the score is below the threshold. Bubble the zeroes up, and set  
min\_score to 0 on the search request.

On Monday, 9 July 2012 05:30:31 UTC-4, [marcus.1....@nokia.com](mailto:marcus.1....@nokia.com) wrote:

> Hi,
> 
> Is it possible to use a min\_query within a filtered query. So not on the  
> whole query object itself, but on the query within the filtered query.  
> I've  
> tried it, but only get error. This is an example of the code I'm using to  
> do  
> the query:
> 
> [Min score within filtered query · GitHub](https://gist.github.com/3075320)
> 
> Am I doing anything wrong or is this not supposed to work?
> 
> Thanks
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Min-score-on-filtered-query-tp4020225.html](http://elasticsearch-users.115913.n3.nabble.com/Min-score-on-filtered-query-tp4020225.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 3:20am UTC](https://discuss.elastic.co/t/min-score-on-filtered-query/8355/3 "2017-07-06T03:20:41Z")

</div>

Closed on July 6, 2017, 3:20am UTC


