# Search exactly value in boolean fields

**URL:** <https://discuss.elastic.co/t/search-exactly-value-in-boolean-fields/24617>\
**Category:** Elasticsearch\
**Created:** [June 30, 2015, 11:23am UTC](https://discuss.elastic.co/t/search-exactly-value-in-boolean-fields/24617 "2015-06-30T11:23:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oranciog](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@oranciog](https://discuss.elastic.co/u/oranciog)\
**Post date:** [June 30, 2015, 11:23am UTC](https://discuss.elastic.co/t/search-exactly-value-in-boolean-fields/24617/1 "2015-06-30T11:23:51Z")

</div>

Hi,

I have an index "test" with a field "is\_boolean" boolean:

{  
"test": {  
"mappings": {  
"default": {  
"properties": {  
"is\_boolean": {  
"type": "boolean"  
}  
}  
}  
}  
}  
}

I want to search this field for some values (I don't know apriori if they are integer, string, boolean or something else).

The search that I made is:

POST [http://localhost:9200/test/default/\_search](http://localhost:9200/test/default/_search)  
{  
"query":  
{  
"term":{"is\_boolean":"something"}  
}  
}

The problem is that the results contain all the elements with "is\_boolean" set to "true".

Is there any way to modify my search in order to retrieve results only when I search for "true"/"false"?

I know it's a stupid example, but I summarized a lot what I'm doing. Also I don't want to retrieve what is in mapping.

Thank you,

---

<div class="post-metadata">

**Author:** ![oranciog](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@oranciog](https://discuss.elastic.co/u/oranciog)\
**Post date:** [July 6, 2015, 1:56pm UTC](https://discuss.elastic.co/t/search-exactly-value-in-boolean-fields/24617/2 "2015-07-06T13:56:23Z")

</div>

Hy,

Does anybody know how to fix this problem?

Thank you

---

<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:03am UTC](https://discuss.elastic.co/t/search-exactly-value-in-boolean-fields/24617/3 "2017-07-06T00:03:26Z")

</div>


