Elasticsearch terms aggregation by strings in an array
How can I write an Elasticsearch terms aggregation that splits the buckets by the entire term rather than individual tokens? For example, I would like to aggregate by state, but the following returns new, york, jersey and california as individual buckets, not New York and New Jersey and California as the buckets as expected: curl -XPOST "http://localhost:9200/my_index/_search" -d' { "aggs" : { "states" : { "terms" : { "field" : "states", "size": 10 } } } }' My use case is like the one described here https://www.elastic.co/guide/en/elasticsearch/guide/current/aggregations-and-analysis.html with