distinct - Elasticsearch, how to return unique values of two fields -


i have index 20 different fields. need able pull unique docs combination of fields "cat" , "sub" unique. in sql way: select unique cat, sub table a; can 1 field way:

{ "size": 0, "aggs" : {     "unique_set" : {         "terms" : { "field" : "cat" }     } }} 

but how add field check uniqueness across 2 fields?

thanks,

the way solve nested aggregations:

{ "size": 0,     "aggs" : {         "unique_set_1" : {              "terms" : {                      "field" : "cats"             },             "aggregations" : {                  "unique_set_2": {                     "terms": {"field": "sub"}                 }             }         }     }  } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -