Elasticsearch- get all values for a given field?

How to get all possible values for field author?

curl -XGET  http://localhost:9200/articles/_search?pretty -d '
{
    "aggs" : {
        "whatever_you_like_here" : {
            "terms" : { "field" : "author", "size":10000 }
        }
    },
    "size" : 0
}'

Note

  • "size":10000 Get at most 10000 unique values. Default is 10.

  • "size":0 By default, "hits" contains 10 documents. We don’t need them.

  • By default, the buckets are ordered by the doc_count in decreasing order.


Reference: bucket terms aggregation

Also note, according to this page, facets have been replaced by aggregations in Elasticsearch 1.0, which are a superset of facets.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)