# Elastic search query to get values only which are not null

**URL:** <https://discuss.elastic.co/t/elastic-search-query-to-get-values-only-which-are-not-null/97390>\
**Category:** Elasticsearch\
**Created:** [August 17, 2017, 10:21am UTC](https://discuss.elastic.co/t/elastic-search-query-to-get-values-only-which-are-not-null/97390 "2017-08-17T10:21:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jyoti\_Shukla](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@Jyoti\_Shukla](https://discuss.elastic.co/u/Jyoti_Shukla)\
**Post date:** [August 17, 2017, 10:21am UTC](https://discuss.elastic.co/t/elastic-search-query-to-get-values-only-which-are-not-null/97390/1 "2017-08-17T10:21:47Z")

</div>

I have written a query and I want only those Actualarrival time which are not [null.As](http://null.As) per the below query I am not getting as [needed.It](http://needed.It) would be helpful if someone figure out the correction.

"nested": {  
"path": "Banks",  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"Banks.Employees.Source\_Geocode.keyword": "17.337203,78.467794"  
}  
},  
{  
"match": {  
"Banks.Employees.Source\_Geocode.keyword": "17.367891,78.468098"  
}  
},  
{  
"exists": {  
"field": "Banks.Employees.ActualArrivalTime"  
}  
}  
]  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [August 17, 2017, 12:43pm UTC](https://discuss.elastic.co/t/elastic-search-query-to-get-values-only-which-are-not-null/97390/2 "2017-08-17T12:43:31Z")

</div>

Do you have an error or unexpected results ? Please provide logs and/or results samples.

---

<div class="post-metadata">

**Author:** ![Jyoti\_Shukla](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@Jyoti\_Shukla](https://discuss.elastic.co/u/Jyoti_Shukla)\
**Post date:** [August 18, 2017, 10:04am UTC](https://discuss.elastic.co/t/elastic-search-query-to-get-values-only-which-are-not-null/97390/3 "2017-08-18T10:04:29Z")

</div>

I am getting 0 hits when used the above query.I guess it's working like if there is any null value then 0 hits is returned rather returning some of the non-null values for arrival time.

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [August 18, 2017, 11:17am UTC](https://discuss.elastic.co/t/elastic-search-query-to-get-values-only-which-are-not-null/97390/4 "2017-08-18T11:17:27Z")

</div>

Do you have documents matching this 3 conditions in the must ? can you provide a sample and the mapping plz ?

---

<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:** [September 15, 2017, 11:22am UTC](https://discuss.elastic.co/t/elastic-search-query-to-get-values-only-which-are-not-null/97390/5 "2017-09-15T11:22:58Z")

</div>

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