Aggregations return result with sum_other_doc_count

When we are doing a terms aggregation we are getting buckets of keys but also some document count under "sum_other_doc_count"

Why are we getting this? How can we bucket these documents?

Got it working.

Just in case some one faces the same issue:

Set "size":0 in your aggregation query to get back all documents.

You should be very careful setting "size":0 in the terms aggregation. It does not scale well for high cardinality fields and can easily lead to OutOfMemoryErrors due to the aggregation request having to stream a lot of transient state from the shards to the coordinating node (the node dealing with the request form your app).