Terms aggregation giving weird results

Let's consider an aggregation in the Author field to get the statistics of each author name:

curl -XPOST  "http://localhost:9200/news/public/_search?pretty&search_type=count" -d '{
    "aggs" : {
      "authors" : {
        "terms" : {
          "field" : "Author"
        }
      }
    }
}'

By giving search_type=count, we make sure that we receive only the aggregation results and not hits or rather, the top-10 results.

The response we get for this is as follows:

{ "took" : 5, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "failed" : 0 }, "hits" : { "total" : 3, "max_score" : 0.0, "hits" : [ ] }, "aggregations" : { "authors" : { "doc_count_error_upper_bound" : 0, "sum_other_doc_count" : 0, "buckets" : [ { "key" : "shankar", "doc_count" : ...

Get Elasticsearch Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.