# Define query filter inside query or in the function

**URL:** <https://discuss.elastic.co/t/define-query-filter-inside-query-or-in-the-function/121413>\
**Category:** Elasticsearch\
**Created:** [February 25, 2018, 11:07pm UTC](https://discuss.elastic.co/t/define-query-filter-inside-query-or-in-the-function/121413 "2018-02-25T23:07:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zao\_Liu](https://avatars.discourse-cdn.com/v4/letter/z/7feea3/32.png) [@Zao\_Liu](https://discuss.elastic.co/u/Zao_Liu)\
**Post date:** [February 25, 2018, 11:07pm UTC](https://discuss.elastic.co/t/define-query-filter-inside-query-or-in-the-function/121413/1 "2018-02-25T23:07:56Z")

</div>

When we apply the function scores, what's the different between defining the filter inside the function itself or add it in the query block?

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [February 26, 2018, 12:14am UTC](https://discuss.elastic.co/t/define-query-filter-inside-query-or-in-the-function/121413/2 "2018-02-26T00:14:27Z")

</div>

Could you please give two example queries that you are trying to compare?

---

<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:** [March 26, 2018, 12:14am UTC](https://discuss.elastic.co/t/define-query-filter-inside-query-or-in-the-function/121413/3 "2018-03-26T00:14:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
