# Filter syntax deprecated?

**URL:** <https://discuss.elastic.co/t/filter-syntax-deprecated/60611>\
**Category:** Elasticsearch\
**Created:** [September 15, 2016, 1:58pm UTC](https://discuss.elastic.co/t/filter-syntax-deprecated/60611 "2016-09-15T13:58:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhondup](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@dhondup](https://discuss.elastic.co/u/dhondup)\
**Post date:** [September 15, 2016, 1:58pm UTC](https://discuss.elastic.co/t/filter-syntax-deprecated/60611/1 "2016-09-15T13:58:11Z")

</div>

I have seen two ways the filter is used. Is 1 still valid or deprecated?

#1  
GET index/\_search  
{  
"filter":{  
"exists": {  
"field": "FIELD\_NAME"  
}  
}  
}

#2

```
{
  "query": {
    "bool": {
      "filter": {
        "exists": {
          "field": "FIELD_NAME"
        }
      }
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [September 15, 2016, 4:12pm UTC](https://discuss.elastic.co/t/filter-syntax-deprecated/60611/2 "2016-09-15T16:12:55Z")

</div>

They are two different things. Option 1) is indeed deprecated, and has been replaced with the `post_filter` syntax: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-post-filter.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-post-filter.html)

But post-filtering is executed after the query clause finishes, as a means to do an additional filtering step. This is really only useful when you are also running aggregations, and want the aggs to be filtered differently from the search results.

Option 2) is the new syntax for the old `filtered` query (which is deprecated as well). This is part of the query, so it's execution is interleaved with the other queries, and it filters both the search and the aggregation results

---

<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 5, 2017, 10:19pm UTC](https://discuss.elastic.co/t/filter-syntax-deprecated/60611/3 "2017-07-05T22:19:58Z")

</div>


