# Query filter not working in ES 5.3

**URL:** <https://discuss.elastic.co/t/query-filter-not-working-in-es-5-3/139733>\
**Category:** Elasticsearch\
**Created:** [July 12, 2018, 10:51am UTC](https://discuss.elastic.co/t/query-filter-not-working-in-es-5-3/139733 "2018-07-12T10:51:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![weiishann](https://avatars.discourse-cdn.com/v4/letter/w/8edcca/32.png) [@weiishann](https://discuss.elastic.co/u/weiishann)\
**Post date:** [July 12, 2018, 10:51am UTC](https://discuss.elastic.co/t/query-filter-not-working-in-es-5-3/139733/1 "2018-07-12T10:51:07Z")

</div>

Hi all!

I'm currently using Elasticsearch 5.3. The query filter doesn't seem to work for me. If I understand correctly, the query below should return all documents with only the specified terms. However, I'm getting back documents with other terms. For example, status: 0.

```
{
						"query": {
						  "filter":[
										{"term": {"status": "requested"}},
										{"term": {"status": "issued"}},
										{"term": {"status": "rejected"}},
										{"term": {"status": "revoked"}},
										{"term": {"type": "identity"}},
										{"term": {"type": "signature"}}
										]
						},
						"size": 1000
						}

```

Am I doing something wrong here?

Thanks!

Regards,  
Wei Shan

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [July 20, 2018, 9:23am UTC](https://discuss.elastic.co/t/query-filter-not-working-in-es-5-3/139733/2 "2018-07-20T09:23:30Z")

</div>

Can you please add the whole query, the index mappings and possibly an example document that you think should not be returned, but currently is returned by your query? Otherwise its hard to judge whats going on.

---

<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:** [August 17, 2018, 9:23am UTC](https://discuss.elastic.co/t/query-filter-not-working-in-es-5-3/139733/3 "2018-08-17T09:23:46Z")

</div>

Closed on August 17, 2018, 9:23am UTC

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