# Exists query on numeric attributes with null\_value gives unexpected result

**URL:** <https://discuss.elastic.co/t/exists-query-on-numeric-attributes-with-null-value-gives-unexpected-result/153279>\
**Category:** Elasticsearch\
**Created:** [October 21, 2018, 10:15am UTC](https://discuss.elastic.co/t/exists-query-on-numeric-attributes-with-null-value-gives-unexpected-result/153279 "2018-10-21T10:15:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![azulay7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azulay7/32/34316_2.png) [@azulay7](https://discuss.elastic.co/u/azulay7)\
**Post date:** [October 21, 2018, 10:15am UTC](https://discuss.elastic.co/t/exists-query-on-numeric-attributes-with-null-value-gives-unexpected-result/153279/1 "2018-10-21T10:15:40Z")

</div>

Hi all,  
I'm working with elastic 6.2.4.  
my index-mapping contains "null\_value".

I've notice that exists query gives different result when working with numeric value.

example:

`PUT person { "mappings": { "_doc": { "properties": { "nickname": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256, "null_value": "null" } } }, "grade":{ "type":"double", "null_value": -1 } } } } }`

`POST /person/_doc/1 { "name":"David", "nickname":null, "grade":null }`

`GET person/_search { "size": 0 , "query": { "exists":{ "field":"grade" } } }`

gives unexpected result \> hits.total: 1.

where

`GET person/_search { "size": 0 , "query": { "exists":{ "field":"nickname" } } }`

gives expected result \> hits.total: 0.

I think it's a BUG.

---

<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:** [November 18, 2018, 10:15am UTC](https://discuss.elastic.co/t/exists-query-on-numeric-attributes-with-null-value-gives-unexpected-result/153279/2 "2018-11-18T10:15:41Z")

</div>

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