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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/eaae8bf4-a64a-44d1-8fe3-6ad2cf76f7c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to