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

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

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

javascript - Restarting Supervisor and effect on FlaskSocketIO -