# Elastic search returns unexplained result when filtering true and filtering false

**URL:** <https://discuss.elastic.co/t/elastic-search-returns-unexplained-result-when-filtering-true-and-filtering-false/58141>\
**Category:** Elasticsearch\
**Created:** [August 16, 2016, 12:50pm UTC](https://discuss.elastic.co/t/elastic-search-returns-unexplained-result-when-filtering-true-and-filtering-false/58141 "2016-08-16T12:50:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stam585](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@stam585](https://discuss.elastic.co/u/stam585)\
**Post date:** [August 16, 2016, 12:50pm UTC](https://discuss.elastic.co/t/elastic-search-returns-unexplained-result-when-filtering-true-and-filtering-false/58141/1 "2016-08-16T12:50:09Z")

</div>

I am running a query in sense that should return all entities with display = true

```
  POST /myIndex/myEntity/_search
  {
   "query": {
	"term": {
		"doc.display": true
	}
     }
  }

```

In my ES index I have one entity with dynamic mapping = false and that contains the field doc.display:

```
"display": {
   "type": "boolean"
},

```

I have two entities in the DB - one with display=true, one with display=false.

when I run the query with "false" it returns one entity.  
when I run the query without filter it returns two entities.  
when I run the query with "true" it returns no entity.

Any idea how can this happen?

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [August 24, 2016, 9:38am UTC](https://discuss.elastic.co/t/elastic-search-returns-unexplained-result-when-filtering-true-and-filtering-false/58141/2 "2016-08-24T09:38:38Z")

</div>

Hi @stam585,

can you please post a complete example (including the mapping you use when you create the index)?

Daniel

---

<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:25pm UTC](https://discuss.elastic.co/t/elastic-search-returns-unexplained-result-when-filtering-true-and-filtering-false/58141/3 "2017-07-05T22:25:36Z")

</div>


