# Difference between filter and filtered query in function\_score?

**URL:** <https://discuss.elastic.co/t/difference-between-filter-and-filtered-query-in-function-score/1036>\
**Category:** Elasticsearch\
**Created:** [May 20, 2015, 9:21pm UTC](https://discuss.elastic.co/t/difference-between-filter-and-filtered-query-in-function-score/1036 "2015-05-20T21:21:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattruzicka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattruzicka/32/44809_2.png) [@mattruzicka](https://discuss.elastic.co/u/mattruzicka)\
**Post date:** [May 20, 2015, 9:21pm UTC](https://discuss.elastic.co/t/difference-between-filter-and-filtered-query-in-function-score/1036/1 "2015-05-20T21:21:06Z")

</div>

When doing a Function Score Query, what's the difference between doing

```
{ function_score: { query { filtered { query: ...

```

and simply

```
{ function_score: { filter: ...

```

Thanks.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 20, 2015, 9:26pm UTC](https://discuss.elastic.co/t/difference-between-filter-and-filtered-query-in-function-score/1036/2 "2015-05-20T21:26:38Z")

</div>

Assuming that you put the same filter under the filtered query in the 1st example and as a filter in the 2nd example, both will behave the same.

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [May 21, 2015, 7:05am UTC](https://discuss.elastic.co/t/difference-between-filter-and-filtered-query-in-function-score/1036/3 "2015-05-21T07:05:10Z")

</div>

> [@jpountz](#):
>
> Assuming that you put the same filter under the filtered query in the 1st example and as a filter in the 2nd example, both will behave the same.

behave the same? the query speed response time too?

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 21, 2015, 7:58am UTC](https://discuss.elastic.co/t/difference-between-filter-and-filtered-query-in-function-score/1036/4 "2015-05-21T07:58:29Z")

</div>

Yes, response times too.

---

<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:12am UTC](https://discuss.elastic.co/t/difference-between-filter-and-filtered-query-in-function-score/1036/5 "2017-07-06T00:12:44Z")

</div>


