# Function\_score executes inner-filter even if query fails

**URL:** <https://discuss.elastic.co/t/function-score-executes-inner-filter-even-if-query-fails/18590>\
**Category:** Elasticsearch\
**Created:** [July 10, 2014, 9:01pm UTC](https://discuss.elastic.co/t/function-score-executes-inner-filter-even-if-query-fails/18590 "2014-07-10T21:01:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Riyaz](https://avatars.discourse-cdn.com/v4/letter/r/ba8739/32.png) [@Riyaz](https://discuss.elastic.co/u/Riyaz)\
**Post date:** [July 10, 2014, 9:01pm UTC](https://discuss.elastic.co/t/function-score-executes-inner-filter-even-if-query-fails/18590/1 "2014-07-10T21:01:59Z")

</div>

Hi,

Am using elasticsearch v0.90.12.

I have a function score query of the form:  
function\_score

- query: Q1
- functions: [{filter:F1, function:func1 }]

Both Q1 & F1 have their names set. This function\_score when executed in  
isolation returns 0 results when Q1 fails. But when this function\_score is  
run within a boolean query combined with other queries, F1 is executed for  
all results though Q1 failed for the results. This can be seen from the matched\_filters  
in results. The scores are not affected though.

Please find the CURL recreation  
here: [https://gist.github.com/hmrizin/da8414d844a8a39fc832](https://gist.github.com/hmrizin/da8414d844a8a39fc832)

Regards  
Riyaz

--  
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/cd3847c7-934f-4c6f-8156-57d4ff1a88c3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cd3847c7-934f-4c6f-8156-57d4ff1a88c3%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, 1:16am UTC](https://discuss.elastic.co/t/function-score-executes-inner-filter-even-if-query-fails/18590/2 "2017-07-06T01:16:42Z")

</div>


