How to aggregate query result in elasticsearch -
i new in elasticsearch. want elasticsearch result following sql query,
select distinct(car_name) car_master car_name '%suv%'
i getting result doing:
{ "query": { "query_string": { "fields" : ["car_name"], "query": "*suv*" } } }
but want distinct records.
you there, need add terms
aggregation on car_name
field:
{ "query": { "query_string": { "fields" : ["car_name"], "query": "*suv*" } }, "aggs": { "cars": { "terms": { "field": "car_name" } } } }
Comments
Post a Comment