# Filtering by nonexistent value returns all results

**URL:** <https://discuss.elastic.co/t/filtering-by-nonexistent-value-returns-all-results/207752>\
**Category:** Elastic Search\
**Tags:** elastic-site-search\
**Created:** [November 13, 2019, 5:11pm UTC](https://discuss.elastic.co/t/filtering-by-nonexistent-value-returns-all-results/207752 "2019-11-13T17:11:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Peters](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_peters/32/57568_2.png) [@Ryan\_Peters](https://discuss.elastic.co/u/Ryan_Peters)\
**Post date:** [November 13, 2019, 5:11pm UTC](https://discuss.elastic.co/t/filtering-by-nonexistent-value-returns-all-results/207752/1 "2019-11-13T17:11:09Z")

</div>

My query:  
{  
engine\_key: 'ENGINE\_KEY',  
q: '',  
page: 1,  
per\_page: 12,  
sort\_field: { page: 'published\_date' },  
filters: {  
page: {  
search\_category: 'How-To Tips & Tricks'  
}  
}  
}

If there are no pages with this search\_category tag on the page, it will return **all** results. If there is 1 page tagged with this search\_category, it will return that one page. I would expect no results if no pages are tagged with this category. Is it possible to run a query where no results are returned on a filter that has no matches?

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [November 15, 2019, 12:02pm UTC](https://discuss.elastic.co/t/filtering-by-nonexistent-value-returns-all-results/207752/2 "2019-11-15T12:02:24Z")

</div>

Hi @Ryan_Peters,

I can't reproduce this:

Request:

```auto
{
	"engine_key": "",
	"q": "",
	"filters": {
		"page": {
			"title": "nope"
		}
	}
}

```

Response:

```auto
...
"record_count": 0
...

```

Request:

```auto
{
	"engine_key": "",
	"q": "",
	"filters": {
		"page": {
			"title": "Tips and Tricks"
		}
	}
}

```

Response:

```auto
...
"record_count": 1
...

```

---

<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:** [December 13, 2019, 12:02pm UTC](https://discuss.elastic.co/t/filtering-by-nonexistent-value-returns-all-results/207752/3 "2019-12-13T12:02:27Z")

</div>

Closed on December 13, 2019, 12:02pm UTC

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