elasticsearch - filtering on 2 values of same field -


i have status field, can have 1 of following values,

enter image description here can filter data have status completed. can see data has ongoing.

but want display data have status completed , ongoing @ same time.

but don't know how add filters 2 values on single field.

how can achieve want ?

edit - answers. not wanted.

enter image description here

like here have filtered status:completed, want filter 2 values in exact way.

i know can edit filter , , , use queries, need simple way this(query way complex), have show marketing team , don't have idea queries. need convince them.

if understand question correctly, want perform aggregation on 2 values of field.

this should possible query similar 1 terms query:

{   "size" : 0,   "query" : {     "bool" : {       "must" : [ {         "terms" : {           "status" : [ "completed", "unpaid" ]         }       } ]     }   },   "aggs" : {     "freqs" : {       "terms" : {         "field" : "status"       }     }   } } 

this give result one:

{   "took" : 2,   "timed_out" : false,   "_shards" : {     "total" : 3,     "successful" : 3,     "failed" : 0   },   "hits" : {     "total" : 5,     "max_score" : 0.0,     "hits" : [ ]   },   "aggregations" : {     "freqs" : {       "doc_count_error_upper_bound" : 0,       "sum_other_doc_count" : 0,       "buckets" : [ {         "key" : "unpaid",         "doc_count" : 4       }, {         "key" : "completed",         "doc_count" : 1       } ]     }   } } 

here toy mapping definition:

{   "bookings" : {     "properties" : {       "status" : {         "type" : "keyword"       }     }   } } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -