GET /_search
{
"size": 0, // don't return any documents, just the aggregation
"aggs" : {
"distinctValues" : { // this can be any label you want
"terms" : {
"field" : "path.to.field", // field to be aggregated
"size" : 500 // how many unique values to return
}
}
}
}