• show all unique values from some column:
    curl -XGET 'localhost:9200/indexname/typename/_search?pretty' -d '
    {"size": 0,
    "aggs": {
    "unique_vals": {
    "terms": {
    "field": "fieldname",
    "size": 0,
    "order": { "_term": "asc" }
    }
    }
    }
    }'
    • “size”:0 outside of “aggs” eliminates showing of data documents
    • “size”:0 inside “terms” ensures we will get all results