Aggregation on non-indexed fields


We are having in one ES 5.4, with 3 nodes and in total 80 shard.

We have 800 million documents in these shards. When we are aggregating on certain fields, we see that it is very slow.

The fields we are aggregating are count and millisecond.

"count": {
  "type": "long",
  "doc_values": true
"millisecond": {
  "type": "scaled_float",
  "scaling_factor": 100,
  "doc_values": true

We are not searching these fields, only aggregating. Should these be indexed?

From an old thread, it seems that indexing is not needed.

Is that still valid with the new ES 5.x?


Yep. Agg uses doc_values. You can try profile the query.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.