# Problems with eliminating null values from query results

**URL:** <https://discuss.elastic.co/t/problems-with-eliminating-null-values-from-query-results/20723>\
**Category:** Elasticsearch\
**Created:** [November 13, 2014, 3:02pm UTC](https://discuss.elastic.co/t/problems-with-eliminating-null-values-from-query-results/20723 "2014-11-13T15:02:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayoussry](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@ayoussry](https://discuss.elastic.co/u/ayoussry)\
**Post date:** [November 13, 2014, 3:02pm UTC](https://discuss.elastic.co/t/problems-with-eliminating-null-values-from-query-results/20723/1 "2014-11-13T15:02:01Z")

</div>

Hello everybody,

I was working on fetching data from elasticsearch index.  
I wanted to filter out documents that contain null or empty string values  
in certain columns.  
Yet when I used either "missing" or "exists" methods I faced some issues  
with values = "" as they were not filtered out and showed in the results

I thought of using wildcard instead but then it gave no results when  
dealing with columns that had multiple words in their ID (ex: Alarm  
Description,Alarm ID,...etc)

Working on elasticsearch-1.3.2

My code with missing/exists :

{  
"query" : {  
"constant\_score" : {  
"filter" : {  
"exists" : {  
"field" : "myfield"  
}  
}  
}  
}  
}

My code with wildcard:

{

- query: {
  - bool: {
    - must: [
      - {
        - constant\_score: {
          - filter: {
            - missing: {
              - field: trap\_message.enterprise  
}  
}  
}  
}  
]

    - must\_not: []
    - should: []  
}  
}

- from: 0
- size: 10
- sort: []
- facets: { }

}

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/eaae8bf4-a64a-44d1-8fe3-6ad2cf76f7c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/eaae8bf4-a64a-44d1-8fe3-6ad2cf76f7c2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:50am UTC](https://discuss.elastic.co/t/problems-with-eliminating-null-values-from-query-results/20723/2 "2017-07-06T00:50:16Z")

</div>


