Count and Stats api showing different doc's count in Elasticsearch? - elasticsearch

1)I have an index "data" which has 479427 documents in it. To get the count i had used GET /data/_search i got response like this
"hits": {
"total": 479427,
"max_score": 1,
2)I checked using count api GET /data/_count and response i got is like this
{
"count": 479427,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
}
}
FROM 1 and 2 the count of articles is same .
But when i tried GET /data/_stats command i am getting different counts in get and total fields.
"data": {
"primaries": {
"docs": {
"count": 2407154,
"deleted": 357392
},
"indexing": {
"index_total": 4926760,
"index_time_in_millis": 31181542,
"index_current": 2744,
"index_failed": 260136,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 175,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 4773829,
"time_in_millis": 857412,
"exists_total": 4773829,
"exists_time_in_millis": 857412,
"missing_total": 0,
"missing_time_in_millis": 0,
"current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 82217,
"total_time_in_millis": 19552894,
"total_docs": 87321796,
"total_size_in_bytes": 281542406990,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 488983,
"total_auto_throttle_in_bytes": 35543080
},
"refresh": {
"total": 956338,
"total_time_in_millis": 29144660
},
"flush": {
"total": 697,
"total_time_in_millis": 469603
},
"segments": {
"count": 114,
"memory_in_bytes": 7145544,
"terms_memory_in_bytes": 4862940,
"stored_fields_memory_in_bytes": 1037064,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 116928,
"doc_values_memory_in_bytes": 1128612,
"index_writer_memory_in_bytes": 13753207,
"index_writer_max_memory_in_bytes": 548831232,
"version_map_memory_in_bytes": 2182,
"fixed_bit_set_memory_in_bytes": 350648
},
"translog": {
"operations": 19488,
"size_in_bytes": 799972235
},
"suggest": {
"total": 0,
"time_in_millis": 0,
"current": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 0
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 13306
}
},
**"total": {
"docs": { >Here i am getting total docs count 4814308
"count": 4814308,
"deleted": 715540
},**
"store": {
"size_in_bytes": 11910376476,
"throttle_time_in_millis": 0
},
"indexing": {
"index_total": 9590499,
"index_time_in_millis": 61324893,
"index_current": 2744,
"index_failed": 310323,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 175,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 4773829,
"time_in_millis": 857412,
"exists_total": 4773829,
"exists_time_in_millis": 857412,
"missing_total": 0,
"missing_time_in_millis": 0,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 21901088,
"query_time_in_millis": 11241895,
"query_current": 0,
"fetch_total": 4578094,
"fetch_time_in_millis": 1774794,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 153172,
"total_time_in_millis": 37586865,
"total_docs": 170014671,
"total_size_in_bytes": 542992816504,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 920242,
"total_auto_throttle_in_bytes": 71693630
},
"refresh": {
"total": 1841635,
"total_time_in_millis": 56292736
},
"flush": {
"total": 1343,
"total_time_in_millis": 946306
},
"warmer": {
"current": 0,
"total": 3822250,
"total_time_in_millis": 1098530
},
"query_cache": {
"memory_size_in_bytes": 2706088,
"total_count": 20222398,
"hit_count": 4846746,
"miss_count": 15375652,
"cache_size": 271,
"cache_count": 2267,
"evictions": 1996
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"percolate": {
"total": 0,
"time_in_millis": 0,
"current": 0,
"memory_size_in_bytes": -1,
"memory_size": "-1b",
"queries": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 229,
"memory_in_bytes": 14245875,
"terms_memory_in_bytes": 9804839,
"stored_fields_memory_in_bytes": 2068360,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 234752,
"doc_values_memory_in_bytes": 2137924,
"index_writer_memory_in_bytes": 25849179,
"index_writer_max_memory_in_bytes": 1097662464,
"version_map_memory_in_bytes": 4364,
"fixed_bit_set_memory_in_bytes": 701360
},
"translog": {
"operations": 39262,
"size_in_bytes": 1616348491
},
"suggest": {
"total": 0,
"time_in_millis": 0,
"current": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 0
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 32764
}
}
}
I even checked the same in curator by giving curator_cli show_indices --verbose which given response like this:
data open 11.1GB 4814308 5 1 2017-05-31T13:00:37Z
Why there is difference ?
Update ----------------------
1)You mean stats API considers each field in nested as a document right?
Note:BTW I am talking about the total.docs.count field in stats api.
2)Where as count API will give the count of documents that are present in the index based on unique id.
So My question is if i want to know how many documents are present inside the index which api gives the right count whether count,get,stats or curator_cli show_indices --verbose(using curator) ?
Thanks

the stats API includes so called nested documents, as fields, which are marked as nested in the mapping are counted as own lucene documents, where as the count API is just counting the top level objects.

Related

Elastic Search update stats per day

Would like to check how many document update request my index actually received per day in elastic search.
I was assuming that this could be done using _stats API, however upon examining the results it is not clear where I can find the update stats.
API used : https://{ip}:{port}/uat-esobject/_stats
{
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"_all": {
"primaries": {
"docs": {
"count": 345347,
"deleted": 25661
},
"store": {
"size_in_bytes": 101712783
},
"indexing": {
"index_total": 11920279,
"index_time_in_millis": 3122742,
"index_current": 0,
"index_failed": 2,
"delete_total": 5484650,
"delete_time_in_millis": 62083,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 27243917,
"time_in_millis": 2149493,
"exists_total": 27182299,
"exists_time_in_millis": 2149177,
"missing_total": 61618,
"missing_time_in_millis": 316,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 64625,
"query_time_in_millis": 47774,
"query_current": 0,
"fetch_total": 32275,
"fetch_time_in_millis": 72630,
"fetch_current": 0,
"scroll_total": 480,
"scroll_time_in_millis": 515310,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 165195,
"total_time_in_millis": 52423254,
"total_docs": 2226667303,
"total_size_in_bytes": 597658087755,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 1752437,
"total_time_in_millis": 27481459,
"listeners": 0
},
"flush": {
"total": 4669,
"periodic": 0,
"total_time_in_millis": 92817
},
"warmer": {
"current": 0,
"total": 1670809,
"total_time_in_millis": 52566
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 315448,
"hit_count": 75641,
"miss_count": 239807,
"cache_size": 0,
"cache_count": 13883,
"evictions": 13883
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 39,
"memory_in_bytes": 971368,
"terms_memory_in_bytes": 886569,
"stored_fields_memory_in_bytes": 38544,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 29952,
"points_memory_in_bytes": 12539,
"doc_values_memory_in_bytes": 3764,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 146754,
"size_in_bytes": 71681210,
"uncommitted_operations": 176,
"uncommitted_size_in_bytes": 87471,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 545
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 345347,
"deleted": 25661
},
"store": {
"size_in_bytes": 101712783
},
"indexing": {
"index_total": 11920279,
"index_time_in_millis": 3122742,
"index_current": 0,
"index_failed": 2,
"delete_total": 5484650,
"delete_time_in_millis": 62083,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 27243917,
"time_in_millis": 2149493,
"exists_total": 27182299,
"exists_time_in_millis": 2149177,
"missing_total": 61618,
"missing_time_in_millis": 316,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 64625,
"query_time_in_millis": 47774,
"query_current": 0,
"fetch_total": 32275,
"fetch_time_in_millis": 72630,
"fetch_current": 0,
"scroll_total": 480,
"scroll_time_in_millis": 515310,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 165195,
"total_time_in_millis": 52423254,
"total_docs": 2226667303,
"total_size_in_bytes": 597658087755,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 1752437,
"total_time_in_millis": 27481459,
"listeners": 0
},
"flush": {
"total": 4669,
"periodic": 0,
"total_time_in_millis": 92817
},
"warmer": {
"current": 0,
"total": 1670809,
"total_time_in_millis": 52566
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 315448,
"hit_count": 75641,
"miss_count": 239807,
"cache_size": 0,
"cache_count": 13883,
"evictions": 13883
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 39,
"memory_in_bytes": 971368,
"terms_memory_in_bytes": 886569,
"stored_fields_memory_in_bytes": 38544,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 29952,
"points_memory_in_bytes": 12539,
"doc_values_memory_in_bytes": 3764,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 146754,
"size_in_bytes": 71681210,
"uncommitted_operations": 176,
"uncommitted_size_in_bytes": 87471,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 545
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
},
"indices": {
"uat-esobject": {
"uuid": "geINqqarQLWbf-bzkdJIhA",
"primaries": {
"docs": {
"count": 345347,
"deleted": 25661
},
"store": {
"size_in_bytes": 101712783
},
"indexing": {
"index_total": 11920279,
"index_time_in_millis": 3122742,
"index_current": 0,
"index_failed": 2,
"delete_total": 5484650,
"delete_time_in_millis": 62083,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 27243917,
"time_in_millis": 2149493,
"exists_total": 27182299,
"exists_time_in_millis": 2149177,
"missing_total": 61618,
"missing_time_in_millis": 316,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 64625,
"query_time_in_millis": 47774,
"query_current": 0,
"fetch_total": 32275,
"fetch_time_in_millis": 72630,
"fetch_current": 0,
"scroll_total": 480,
"scroll_time_in_millis": 515310,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 165195,
"total_time_in_millis": 52423254,
"total_docs": 2226667303,
"total_size_in_bytes": 597658087755,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 1752437,
"total_time_in_millis": 27481459,
"listeners": 0
},
"flush": {
"total": 4669,
"periodic": 0,
"total_time_in_millis": 92817
},
"warmer": {
"current": 0,
"total": 1670809,
"total_time_in_millis": 52566
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 315448,
"hit_count": 75641,
"miss_count": 239807,
"cache_size": 0,
"cache_count": 13883,
"evictions": 13883
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 39,
"memory_in_bytes": 971368,
"terms_memory_in_bytes": 886569,
"stored_fields_memory_in_bytes": 38544,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 29952,
"points_memory_in_bytes": 12539,
"doc_values_memory_in_bytes": 3764,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 146754,
"size_in_bytes": 71681210,
"uncommitted_operations": 176,
"uncommitted_size_in_bytes": 87471,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 545
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 345347,
"deleted": 25661
},
"store": {
"size_in_bytes": 101712783
},
"indexing": {
"index_total": 11920279,
"index_time_in_millis": 3122742,
"index_current": 0,
"index_failed": 2,
"delete_total": 5484650,
"delete_time_in_millis": 62083,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 27243917,
"time_in_millis": 2149493,
"exists_total": 27182299,
"exists_time_in_millis": 2149177,
"missing_total": 61618,
"missing_time_in_millis": 316,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 64625,
"query_time_in_millis": 47774,
"query_current": 0,
"fetch_total": 32275,
"fetch_time_in_millis": 72630,
"fetch_current": 0,
"scroll_total": 480,
"scroll_time_in_millis": 515310,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 165195,
"total_time_in_millis": 52423254,
"total_docs": 2226667303,
"total_size_in_bytes": 597658087755,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 1752437,
"total_time_in_millis": 27481459,
"listeners": 0
},
"flush": {
"total": 4669,
"periodic": 0,
"total_time_in_millis": 92817
},
"warmer": {
"current": 0,
"total": 1670809,
"total_time_in_millis": 52566
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 315448,
"hit_count": 75641,
"miss_count": 239807,
"cache_size": 0,
"cache_count": 13883,
"evictions": 13883
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 39,
"memory_in_bytes": 971368,
"terms_memory_in_bytes": 886569,
"stored_fields_memory_in_bytes": 38544,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 29952,
"points_memory_in_bytes": 12539,
"doc_values_memory_in_bytes": 3764,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 146754,
"size_in_bytes": 71681210,
"uncommitted_operations": 176,
"uncommitted_size_in_bytes": 87471,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 545
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
}
}
}
{
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"_all": {
"primaries": {
"docs": {
"count": 345347,
"deleted": 25661
},
"store": {
"size_in_bytes": 101712783
},
"indexing": {
"index_total": 11920279,
"index_time_in_millis": 3122742,
"index_current": 0,
"index_failed": 2,
"delete_total": 5484650,
"delete_time_in_millis": 62083,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 27243917,
"time_in_millis": 2149493,
"exists_total": 27182299,
"exists_time_in_millis": 2149177,
"missing_total": 61618,
"missing_time_in_millis": 316,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 64625,
"query_time_in_millis": 47774,
"query_current": 0,
"fetch_total": 32275,
"fetch_time_in_millis": 72630,
"fetch_current": 0,
"scroll_total": 480,
"scroll_time_in_millis": 515310,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 165195,
"total_time_in_millis": 52423254,
"total_docs": 2226667303,
"total_size_in_bytes": 597658087755,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 1752437,
"total_time_in_millis": 27481459,
"listeners": 0
},
"flush": {
"total": 4669,
"periodic": 0,
"total_time_in_millis": 92817
},
"warmer": {
"current": 0,
"total": 1670809,
"total_time_in_millis": 52566
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 315448,
"hit_count": 75641,
"miss_count": 239807,
"cache_size": 0,
"cache_count": 13883,
"evictions": 13883
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 39,
"memory_in_bytes": 971368,
"terms_memory_in_bytes": 886569,
"stored_fields_memory_in_bytes": 38544,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 29952,
"points_memory_in_bytes": 12539,
"doc_values_memory_in_bytes": 3764,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 146754,
"size_in_bytes": 71681210,
"uncommitted_operations": 176,
"uncommitted_size_in_bytes": 87471,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 545
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 345347,
"deleted": 25661
},
"store": {
"size_in_bytes": 101712783
},
"indexing": {
"index_total": 11920279,
"index_time_in_millis": 3122742,
"index_current": 0,
"index_failed": 2,
"delete_total": 5484650,
"delete_time_in_millis": 62083,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 27243917,
"time_in_millis": 2149493,
"exists_total": 27182299,
"exists_time_in_millis": 2149177,
"missing_total": 61618,
"missing_time_in_millis": 316,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 64625,
"query_time_in_millis": 47774,
"query_current": 0,
"fetch_total": 32275,
"fetch_time_in_millis": 72630,
"fetch_current": 0,
"scroll_total": 480,
"scroll_time_in_millis": 515310,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 165195,
"total_time_in_millis": 52423254,
"total_docs": 2226667303,
"total_size_in_bytes": 597658087755,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 1752437,
"total_time_in_millis": 27481459,
"listeners": 0
},
"flush": {
"total": 4669,
"periodic": 0,
"total_time_in_millis": 92817
},
"warmer": {
"current": 0,
"total": 1670809,
"total_time_in_millis": 52566
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 315448,
"hit_count": 75641,
"miss_count": 239807,
"cache_size": 0,
"cache_count": 13883,
"evictions": 13883
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 39,
"memory_in_bytes": 971368,
"terms_memory_in_bytes": 886569,
"stored_fields_memory_in_bytes": 38544,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 29952,
"points_memory_in_bytes": 12539,
"doc_values_memory_in_bytes": 3764,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 146754,
"size_in_bytes": 71681210,
"uncommitted_operations": 176,
"uncommitted_size_in_bytes": 87471,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 545
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
},
"indices": {
"uat-esobject": {
"uuid": "geINqqarQLWbf-bzkdJIhA",
"primaries": {
"docs": {
"count": 345347,
"deleted": 25661
},
"store": {
"size_in_bytes": 101712783
},
"indexing": {
"index_total": 11920279,
"index_time_in_millis": 3122742,
"index_current": 0,
"index_failed": 2,
"delete_total": 5484650,
"delete_time_in_millis": 62083,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 27243917,
"time_in_millis": 2149493,
"exists_total": 27182299,
"exists_time_in_millis": 2149177,
"missing_total": 61618,
"missing_time_in_millis": 316,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 64625,
"query_time_in_millis": 47774,
"query_current": 0,
"fetch_total": 32275,
"fetch_time_in_millis": 72630,
"fetch_current": 0,
"scroll_total": 480,
"scroll_time_in_millis": 515310,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 165195,
"total_time_in_millis": 52423254,
"total_docs": 2226667303,
"total_size_in_bytes": 597658087755,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 1752437,
"total_time_in_millis": 27481459,
"listeners": 0
},
"flush": {
"total": 4669,
"periodic": 0,
"total_time_in_millis": 92817
},
"warmer": {
"current": 0,
"total": 1670809,
"total_time_in_millis": 52566
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 315448,
"hit_count": 75641,
"miss_count": 239807,
"cache_size": 0,
"cache_count": 13883,
"evictions": 13883
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 39,
"memory_in_bytes": 971368,
"terms_memory_in_bytes": 886569,
"stored_fields_memory_in_bytes": 38544,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 29952,
"points_memory_in_bytes": 12539,
"doc_values_memory_in_bytes": 3764,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 146754,
"size_in_bytes": 71681210,
"uncommitted_operations": 176,
"uncommitted_size_in_bytes": 87471,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 545
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 345347,
"deleted": 25661
},
"store": {
"size_in_bytes": 101712783
},
"indexing": {
"index_total": 11920279,
"index_time_in_millis": 3122742,
"index_current": 0,
"index_failed": 2,
"delete_total": 5484650,
"delete_time_in_millis": 62083,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 27243917,
"time_in_millis": 2149493,
"exists_total": 27182299,
"exists_time_in_millis": 2149177,
"missing_total": 61618,
"missing_time_in_millis": 316,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 64625,
"query_time_in_millis": 47774,
"query_current": 0,
"fetch_total": 32275,
"fetch_time_in_millis": 72630,
"fetch_current": 0,
"scroll_total": 480,
"scroll_time_in_millis": 515310,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 165195,
"total_time_in_millis": 52423254,
"total_docs": 2226667303,
"total_size_in_bytes": 597658087755,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 1752437,
"total_time_in_millis": 27481459,
"listeners": 0
},
"flush": {
"total": 4669,
"periodic": 0,
"total_time_in_millis": 92817
},
"warmer": {
"current": 0,
"total": 1670809,
"total_time_in_millis": 52566
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 315448,
"hit_count": 75641,
"miss_count": 239807,
"cache_size": 0,
"cache_count": 13883,
"evictions": 13883
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 39,
"memory_in_bytes": 971368,
"terms_memory_in_bytes": 886569,
"stored_fields_memory_in_bytes": 38544,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 29952,
"points_memory_in_bytes": 12539,
"doc_values_memory_in_bytes": 3764,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 146754,
"size_in_bytes": 71681210,
"uncommitted_operations": 176,
"uncommitted_size_in_bytes": 87471,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 545
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
}
}
}
These stats shows the value from the last restart of ES node, what you can do is write a cron job which check the value of these stats same time everyday, that way you can subtract the today count from yesterday's count and get the stats you are looking for.
And under indexing section index_total is the total index operation at the index since last node restart which you should use for your use-case.

Why is my Elasticsearch index using so much disk space?

Currently im running into a disk space issue on my server and seem to have found the culprit:
Supposibly according to some people the size of this index is ~ 40 gb. Which sounds ridiculous because the average list of coords that I save is about 5 elements.
This index has 11k documents.
What I have tried:
Deleted the index and filled it up again, this resulted in a MUCH MUCH smaller index on elasticsearch 40GB -> 14MB?? Which is why im very skeptical as to if this will work at all.
Tried to research trough google without any concrete solutions.
I really hope someone might have some insight why it could possibly be this big.
My Elasticsearch version is: 5.6.11
my settings:
{
"my_polygons_1": {
"settings": {
"index": {
"number_of_shards": "5",
"provided_name": "my_polygons_1",
"creation_date": "1514988794703",
"analysis": {
"filter": {
"addresstranslation": {
"type": "synonym",
"synonyms": [
"1e,eerste",
"2e,tweede",
"3e,derde",
"1ste,eerste",
"2de,tweede",
"3de,derde"
]
},
"translation": {
"token_chars": [
"letter",
"digit",
"whitespace"
],
"min_gram": "3",
"type": "nGram",
"max_gram": "50"
}
},
"analyzer": {
"translation_index_analyzer": {
"filter": "standard,lowercase,asciifolding,translation",
"type": "custom",
"tokenizer": "standard"
},
"address_search_analyzer": {
"filter": "standard,lowercase,asciifolding,addresstranslation",
"type": "custom",
"tokenizer": "standard"
},
"address_index_analyzer": {
"filter": "standard,lowercase,asciifolding,addresstranslation,translation",
"type": "custom",
"tokenizer": "standard"
},
"translation_search_analyzer": {
"filter": "standard,lowercase,asciifolding",
"type": "custom",
"tokenizer": "standard"
}
}
},
"number_of_replicas": "1",
"uuid": "lQPnGOZ6TdKx9xZwNPfs2g",
"version": {
"created": "5060399"
}
}
}
}
}
my _stats:
{
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"_all": {
"primaries": {
"docs": {
"count": 11331,
"deleted": 646
},
"store": {
"size_in_bytes": 22095974914,
"throttle_time_in_millis": 0
},
"indexing": {
"index_total": 1184,
"index_time_in_millis": 1166437,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 368507,
"time_in_millis": 159070,
"exists_total": 354156,
"exists_time_in_millis": 157586,
"missing_total": 14351,
"missing_time_in_millis": 1484,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 185,
"query_time_in_millis": 46,
"query_current": 0,
"fetch_total": 30,
"fetch_time_in_millis": 89,
"fetch_current": 0,
"scroll_total": 2,
"scroll_time_in_millis": 2444,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 132,
"total_time_in_millis": 714437,
"total_docs": 6268,
"total_size_in_bytes": 9036940847,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 88138,
"total_auto_throttle_in_bytes": 73181749
},
"refresh": {
"total": 3971,
"total_time_in_millis": 1052798,
"listeners": 0
},
"flush": {
"total": 1063,
"total_time_in_millis": 10994
},
"warmer": {
"current": 0,
"total": 3474,
"total_time_in_millis": 55
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 0,
"hit_count": 0,
"miss_count": 0,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 123,
"memory_in_bytes": 597667360,
"terms_memory_in_bytes": 597553396,
"stored_fields_memory_in_bytes": 38640,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 7872,
"points_memory_in_bytes": 368,
"doc_values_memory_in_bytes": 67084,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 0,
"size_in_bytes": 215
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 8,
"hit_count": 0,
"miss_count": 100
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 22662,
"deleted": 2356
},
"store": {
"size_in_bytes": 46187867347,
"throttle_time_in_millis": 0
},
"indexing": {
"index_total": 2263,
"index_time_in_millis": 2216831,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 657621,
"time_in_millis": 250947,
"exists_total": 628867,
"exists_time_in_millis": 247657,
"missing_total": 28754,
"missing_time_in_millis": 3290,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 375,
"query_time_in_millis": 128,
"query_current": 0,
"fetch_total": 73,
"fetch_time_in_millis": 219,
"fetch_current": 0,
"scroll_total": 5,
"scroll_time_in_millis": 6110,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 252,
"total_time_in_millis": 1134358,
"total_docs": 10222,
"total_size_in_bytes": 13797985517,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 160514,
"total_auto_throttle_in_bytes": 155271619
},
"refresh": {
"total": 7539,
"total_time_in_millis": 1978415,
"listeners": 0
},
"flush": {
"total": 2030,
"total_time_in_millis": 21846
},
"warmer": {
"current": 0,
"total": 6641,
"total_time_in_millis": 105
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 0,
"hit_count": 0,
"miss_count": 0,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 261,
"memory_in_bytes": 1246021155,
"terms_memory_in_bytes": 1245778862,
"stored_fields_memory_in_bytes": 81992,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 16704,
"points_memory_in_bytes": 769,
"doc_values_memory_in_bytes": 142828,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 0,
"size_in_bytes": 430
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 16,
"hit_count": 0,
"miss_count": 200
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
},
"indices": {
"my_polygons_1": {
"primaries": {
"docs": {
"count": 11331,
"deleted": 646
},
"store": {
"size_in_bytes": 22095974914,
"throttle_time_in_millis": 0
},
"indexing": {
"index_total": 1184,
"index_time_in_millis": 1166437,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 368507,
"time_in_millis": 159070,
"exists_total": 354156,
"exists_time_in_millis": 157586,
"missing_total": 14351,
"missing_time_in_millis": 1484,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 185,
"query_time_in_millis": 46,
"query_current": 0,
"fetch_total": 30,
"fetch_time_in_millis": 89,
"fetch_current": 0,
"scroll_total": 2,
"scroll_time_in_millis": 2444,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 132,
"total_time_in_millis": 714437,
"total_docs": 6268,
"total_size_in_bytes": 9036940847,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 88138,
"total_auto_throttle_in_bytes": 73181749
},
"refresh": {
"total": 3971,
"total_time_in_millis": 1052798,
"listeners": 0
},
"flush": {
"total": 1063,
"total_time_in_millis": 10994
},
"warmer": {
"current": 0,
"total": 3474,
"total_time_in_millis": 55
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 0,
"hit_count": 0,
"miss_count": 0,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 123,
"memory_in_bytes": 597667360,
"terms_memory_in_bytes": 597553396,
"stored_fields_memory_in_bytes": 38640,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 7872,
"points_memory_in_bytes": 368,
"doc_values_memory_in_bytes": 67084,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 0,
"size_in_bytes": 215
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 8,
"hit_count": 0,
"miss_count": 100
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 22662,
"deleted": 2356
},
"store": {
"size_in_bytes": 46187867347,
"throttle_time_in_millis": 0
},
"indexing": {
"index_total": 2263,
"index_time_in_millis": 2216831,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 657621,
"time_in_millis": 250947,
"exists_total": 628867,
"exists_time_in_millis": 247657,
"missing_total": 28754,
"missing_time_in_millis": 3290,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 375,
"query_time_in_millis": 128,
"query_current": 0,
"fetch_total": 73,
"fetch_time_in_millis": 219,
"fetch_current": 0,
"scroll_total": 5,
"scroll_time_in_millis": 6110,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 252,
"total_time_in_millis": 1134358,
"total_docs": 10222,
"total_size_in_bytes": 13797985517,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 160514,
"total_auto_throttle_in_bytes": 155271619
},
"refresh": {
"total": 7539,
"total_time_in_millis": 1978415,
"listeners": 0
},
"flush": {
"total": 2030,
"total_time_in_millis": 21846
},
"warmer": {
"current": 0,
"total": 6641,
"total_time_in_millis": 105
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 0,
"hit_count": 0,
"miss_count": 0,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 261,
"memory_in_bytes": 1246021155,
"terms_memory_in_bytes": 1245778862,
"stored_fields_memory_in_bytes": 81992,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 16704,
"points_memory_in_bytes": 769,
"doc_values_memory_in_bytes": 142828,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 0,
"size_in_bytes": 430
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 16,
"hit_count": 0,
"miss_count": 200
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
}
}
}
and my mapping:
{
"my_polygons_1": {
"aliases": {},
"mappings": {
"my_polygons_1": {
"properties": {
"client_id": {
"type": "integer"
},
"id": {
"type": "integer"
},
"name": {
"type": "keyword"
},
"polygon": {
"type": "geo_shape",
"tree": "quadtree",
"precision": "1.0m"
}
}
}
},
"settings": {
"index": {
"number_of_shards": "5",
"provided_name": "my_polygons_1",
"creation_date": "1514988794703",
"analysis": {
"filter": {
"addresstranslation": {
"type": "synonym",
"synonyms": [
"1e,eerste",
"2e,tweede",
"3e,derde",
"1ste,eerste",
"2de,tweede",
"3de,derde"
]
},
"translation": {
"token_chars": [
"letter",
"digit",
"whitespace"
],
"min_gram": "3",
"type": "nGram",
"max_gram": "50"
}
},
"analyzer": {
"translation_index_analyzer": {
"filter": "standard,lowercase,asciifolding,translation",
"type": "custom",
"tokenizer": "standard"
},
"address_search_analyzer": {
"filter": "standard,lowercase,asciifolding,addresstranslation",
"type": "custom",
"tokenizer": "standard"
},
"address_index_analyzer": {
"filter": "standard,lowercase,asciifolding,addresstranslation,translation",
"type": "custom",
"tokenizer": "standard"
},
"translation_search_analyzer": {
"filter": "standard,lowercase,asciifolding",
"type": "custom",
"tokenizer": "standard"
}
}
},
"number_of_replicas": "1",
"uuid": "lQPnGOZ6TdKx9xZwNPfs2g",
"version": {
"created": "5060399"
}
}
}
}
}

Elasticsearch : Document count is lesser than the number of document indexed

I am indexing via bulk api (provided by org.elasticsearch.client.RestHighLevelClient), the number of document I index is 381942 but when I use the _count api of elasticsearch it shows lesser count, that number varies each time I index but it is always less (e.g. 238632, 279241, 282325 etc). When I try to refresh then the count increases by 1. What's going on?
Note: I have checked the response and there are no failures, as well.
Java Code :
BulkRequest bulkRequest = new BulkRequest();
for (FileEntity fileEntity : entities) {
File file = entityToFile(fileEntity);
Map<String, Object> dataMap = objectMapper.convertValue(file, Map.class);
IndexRequest indexRequest = new IndexRequest(INDEX, TYPE, file.getId().toString())
.source(dataMap);
bulkRequest.add(indexRequest);
}
try {
BulkResponse response = restHighLevelClient.bulk(bulkRequest);
System.out.println(response.getItems().length+" : "+response.hasFailures());
} catch(ElasticsearchException e) {
e.getDetailedMessage();
} catch (java.io.IOException ex){
ex.getLocalizedMessage();
}
ES query
{ "query": { "match_all": { }} }
Update : Adding index stats
{
"_shards": {
"total": 10,
"successful": 5,
"failed": 0
},
"_all": {
"primaries": {
"docs": {
"count": 242217,
"deleted": 84242
},
"store": {
"size_in_bytes": 81527525
},
"indexing": {
"index_total": 381942,
"index_time_in_millis": 21265,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 0,
"time_in_millis": 0,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 0,
"missing_time_in_millis": 0,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 10,
"query_time_in_millis": 0,
"query_current": 0,
"fetch_total": 0,
"fetch_time_in_millis": 0,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 5,
"total_time_in_millis": 13133,
"total_docs": 232660,
"total_size_in_bytes": 60188264,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 122,
"total_time_in_millis": 31415,
"listeners": 0
},
"flush": {
"total": 0,
"periodic": 0,
"total_time_in_millis": 0
},
"warmer": {
"current": 0,
"total": 96,
"total_time_in_millis": 2
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 0,
"hit_count": 0,
"miss_count": 0,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 38,
"memory_in_bytes": 390123,
"terms_memory_in_bytes": 344621,
"stored_fields_memory_in_bytes": 26752,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 7296,
"points_memory_in_bytes": 7494,
"doc_values_memory_in_bytes": 3960,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 381942,
"size_in_bytes": 113256156,
"uncommitted_operations": 381942,
"uncommitted_size_in_bytes": 113256156,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 3495,
"evictions": 0,
"hit_count": 5,
"miss_count": 5
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 242217,
"deleted": 84242
},
"store": {
"size_in_bytes": 81527525
},
"indexing": {
"index_total": 381942,
"index_time_in_millis": 21265,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 0,
"time_in_millis": 0,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 0,
"missing_time_in_millis": 0,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 10,
"query_time_in_millis": 0,
"query_current": 0,
"fetch_total": 0,
"fetch_time_in_millis": 0,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 5,
"total_time_in_millis": 13133,
"total_docs": 232660,
"total_size_in_bytes": 60188264,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 122,
"total_time_in_millis": 31415,
"listeners": 0
},
"flush": {
"total": 0,
"periodic": 0,
"total_time_in_millis": 0
},
"warmer": {
"current": 0,
"total": 96,
"total_time_in_millis": 2
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 0,
"hit_count": 0,
"miss_count": 0,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 38,
"memory_in_bytes": 390123,
"terms_memory_in_bytes": 344621,
"stored_fields_memory_in_bytes": 26752,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 7296,
"points_memory_in_bytes": 7494,
"doc_values_memory_in_bytes": 3960,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 381942,
"size_in_bytes": 113256156,
"uncommitted_operations": 381942,
"uncommitted_size_in_bytes": 113256156,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 3495,
"evictions": 0,
"hit_count": 5,
"miss_count": 5
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
},
"indices": {
"test_index": {
"uuid": "uhSpFQr-Qk2yb4_vvA8siQ",
"primaries": {
"docs": {
"count": 242217,
"deleted": 84242
},
"store": {
"size_in_bytes": 81527525
},
"indexing": {
"index_total": 381942,
"index_time_in_millis": 21265,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 0,
"time_in_millis": 0,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 0,
"missing_time_in_millis": 0,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 10,
"query_time_in_millis": 0,
"query_current": 0,
"fetch_total": 0,
"fetch_time_in_millis": 0,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 5,
"total_time_in_millis": 13133,
"total_docs": 232660,
"total_size_in_bytes": 60188264,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 122,
"total_time_in_millis": 31415,
"listeners": 0
},
"flush": {
"total": 0,
"periodic": 0,
"total_time_in_millis": 0
},
"warmer": {
"current": 0,
"total": 96,
"total_time_in_millis": 2
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 0,
"hit_count": 0,
"miss_count": 0,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 38,
"memory_in_bytes": 390123,
"terms_memory_in_bytes": 344621,
"stored_fields_memory_in_bytes": 26752,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 7296,
"points_memory_in_bytes": 7494,
"doc_values_memory_in_bytes": 3960,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 381942,
"size_in_bytes": 113256156,
"uncommitted_operations": 381942,
"uncommitted_size_in_bytes": 113256156,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 3495,
"evictions": 0,
"hit_count": 5,
"miss_count": 5
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 242217,
"deleted": 84242
},
"store": {
"size_in_bytes": 81527525
},
"indexing": {
"index_total": 381942,
"index_time_in_millis": 21265,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 0,
"time_in_millis": 0,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 0,
"missing_time_in_millis": 0,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 10,
"query_time_in_millis": 0,
"query_current": 0,
"fetch_total": 0,
"fetch_time_in_millis": 0,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 5,
"total_time_in_millis": 13133,
"total_docs": 232660,
"total_size_in_bytes": 60188264,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 104857600
},
"refresh": {
"total": 122,
"total_time_in_millis": 31415,
"listeners": 0
},
"flush": {
"total": 0,
"periodic": 0,
"total_time_in_millis": 0
},
"warmer": {
"current": 0,
"total": 96,
"total_time_in_millis": 2
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 0,
"hit_count": 0,
"miss_count": 0,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 38,
"memory_in_bytes": 390123,
"terms_memory_in_bytes": 344621,
"stored_fields_memory_in_bytes": 26752,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 7296,
"points_memory_in_bytes": 7494,
"doc_values_memory_in_bytes": 3960,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 381942,
"size_in_bytes": 113256156,
"uncommitted_operations": 381942,
"uncommitted_size_in_bytes": 113256156,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 3495,
"evictions": 0,
"hit_count": 5,
"miss_count": 5
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
}
}
}

>10sec aggregation performance in elasticsearch

I'm new to elasticsearch and have recently setup a flow of storing JMX data polled every 10seconds into an elasticearch index that looks like this:
{
"jmxmetrics": {
"mappings": {
"kafkajmx": {
"properties": {
"#timestamp": {
"type": "date"
},
"#version": {
"type": "keyword"
},
"attr_type": {
"type": "keyword"
},
"host": {
"type": "keyword"
},
"kafka_broker_id": {
"type": "keyword"
},
"kafka_clientId": {
"type": "keyword"
},
"kafka_fetcher_id": {
"type": "keyword"
},
"kafka_metric_group": {
"type": "keyword"
},
"kafka_metric_name": {
"type": "keyword"
},
"kafka_metric_type": {
"type": "keyword"
},
"kafka_topic": {
"type": "keyword"
},
"metric_path": {
"type": "text"
},
"metric_value_number": {
"type": "long"
},
"metric_value_string": {
"type": "keyword"
},
"path": {
"type": "text"
},
"topic_partition": {
"type": "keyword"
}
}
}
}
}
}
I'm then using a web portal built in ReactJs to hit the API endpoints in elastic search so that I can populate things like: hosts in a drop down, or topics in that host that was selected.
For example, if I run this query:
POST /jmxmetrics/kafkajmx/_search
{
"size": 0,
"aggs" : {
"topics": {
"filter": {
"range": {
"#timestamp": {
"from": "now-60s"
}
}
},
"aggs": {
"topics":{
"terms": {
"field": "kafka_topic",
"size": 500
}
}
}
}
},
"query": {
"match": {
"host": "host_A"
}
}
}
it takes about 25seconds to return:
{
"took": 24709,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"failed": 0
},
"hits": {
"total": 1053380207,
"max_score": 0,
"hits": []
},
"aggregations": {
"topics": {
"doc_count": 54915,
"topics": {
"doc_count_error_upper_bound": 189,
"sum_other_doc_count": 45098,
"buckets": [
{
"key": "__consumer_offsets",
"doc_count": 503
},
{
"key": "topic 1",
"doc_count": 196
},
{
"key": "topic 2",
"doc_count": 193
},
{
"key": "topic 3",
"doc_count": 142
},
...
]
}
}
}
}
Any elasticsearch aggregation query seems to take 10+ seconds to run, and my cluster topology looks like this (running on AWS Ec2):
3 master/data nodes c4.2xlarge (8 cores, and 15Gb ram)
1 client node t2.large (2 cores, 8gb ram)
Any idea on what I could be improving here? I know this is a fairly broad question but any pointers will be helpful.
-------EDIT--------
Here are my settings:
{
"jmxmetrics": {
"settings": {
"index": {
"creation_date": "1489771989403",
"number_of_shards": "3",
"number_of_replicas": "2",
"uuid": "DeLP9MrQT6S_kILMmXorew",
"version": {
"created": "5020199"
},
"provided_name": "sdpjmx"
}
}
}
}
also, here are my stats:
{
"_shards": {
"total": 9,
"successful": 9,
"failed": 0
},
"_all": {
"primaries": {
"docs": {
"count": 1402484967,
"deleted": 0
},
"store": {
"size_in_bytes": 261239372859,
"throttle_time_in_millis": 0
},
"indexing": {
"index_total": 1402487151,
"index_time_in_millis": 108231827,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 1,
"time_in_millis": 13,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 1,
"missing_time_in_millis": 13,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 692,
"query_time_in_millis": 1390846,
"query_current": 0,
"fetch_total": 76,
"fetch_time_in_millis": 15444,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 4,
"current_docs": 57546764,
"current_size_in_bytes": 10961768409,
"total": 359830,
"total_time_in_millis": 298632418,
"total_docs": 8639051262,
"total_size_in_bytes": 1733171768674,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 208268389,
"total_auto_throttle_in_bytes": 15728640
},
"refresh": {
"total": 2290338,
"total_time_in_millis": 27698495,
"listeners": 0
},
"flush": {
"total": 1398,
"total_time_in_millis": 512144
},
"warmer": {
"current": 0,
"total": 2291685,
"total_time_in_millis": 365893
},
"query_cache": {
"memory_size_in_bytes": 131229184,
"total_count": 13019,
"hit_count": 905,
"miss_count": 12114,
"cache_size": 118,
"cache_count": 139,
"evictions": 21
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 167,
"memory_in_bytes": 868415719,
"terms_memory_in_bytes": 731359089,
"stored_fields_memory_in_bytes": 125593776,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 32064,
"points_memory_in_bytes": 11138810,
"doc_values_memory_in_bytes": 291980,
"index_writer_memory_in_bytes": 9788964,
"version_map_memory_in_bytes": 290304,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 529724,
"size_in_bytes": 275528684
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 84
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 4207454779,
"deleted": 0
},
"store": {
"size_in_bytes": 776849456528,
"throttle_time_in_millis": 0
},
"indexing": {
"index_total": 4207461365,
"index_time_in_millis": 333522565,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 2,
"time_in_millis": 13,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 2,
"missing_time_in_millis": 13,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 2046,
"query_time_in_millis": 4439867,
"query_current": 0,
"fetch_total": 204,
"fetch_time_in_millis": 61910,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 9,
"current_docs": 90922106,
"current_size_in_bytes": 17436129588,
"total": 993305,
"total_time_in_millis": 889392309,
"total_docs": 25596362951,
"total_size_in_bytes": 5109527514241,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 622031369,
"total_auto_throttle_in_bytes": 47185920
},
"refresh": {
"total": 6870703,
"total_time_in_millis": 80442220,
"listeners": 0
},
"flush": {
"total": 4194,
"total_time_in_millis": 1542414
},
"warmer": {
"current": 0,
"total": 6874724,
"total_time_in_millis": 1048456
},
"query_cache": {
"memory_size_in_bytes": 428618904,
"total_count": 38315,
"hit_count": 3196,
"miss_count": 35119,
"cache_size": 371,
"cache_count": 438,
"evictions": 67
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 492,
"memory_in_bytes": 2604314152,
"terms_memory_in_bytes": 2194198429,
"stored_fields_memory_in_bytes": 375756256,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 94464,
"points_memory_in_bytes": 33422427,
"doc_values_memory_in_bytes": 842576,
"index_writer_memory_in_bytes": 22793264,
"version_map_memory_in_bytes": 853888,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 1591047,
"size_in_bytes": 827579505
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 345
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
},
"indices": {
"jmxmetrics": {
"primaries": {
"docs": {
"count": 1402484967,
"deleted": 0
},
"store": {
"size_in_bytes": 261239372859,
"throttle_time_in_millis": 0
},
"indexing": {
"index_total": 1402487151,
"index_time_in_millis": 108231827,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 1,
"time_in_millis": 13,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 1,
"missing_time_in_millis": 13,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 692,
"query_time_in_millis": 1390846,
"query_current": 0,
"fetch_total": 76,
"fetch_time_in_millis": 15444,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 4,
"current_docs": 57546764,
"current_size_in_bytes": 10961768409,
"total": 359830,
"total_time_in_millis": 298632418,
"total_docs": 8639051262,
"total_size_in_bytes": 1733171768674,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 208268389,
"total_auto_throttle_in_bytes": 15728640
},
"refresh": {
"total": 2290338,
"total_time_in_millis": 27698495,
"listeners": 0
},
"flush": {
"total": 1398,
"total_time_in_millis": 512144
},
"warmer": {
"current": 0,
"total": 2291685,
"total_time_in_millis": 365893
},
"query_cache": {
"memory_size_in_bytes": 131229184,
"total_count": 13019,
"hit_count": 905,
"miss_count": 12114,
"cache_size": 118,
"cache_count": 139,
"evictions": 21
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 167,
"memory_in_bytes": 868415719,
"terms_memory_in_bytes": 731359089,
"stored_fields_memory_in_bytes": 125593776,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 32064,
"points_memory_in_bytes": 11138810,
"doc_values_memory_in_bytes": 291980,
"index_writer_memory_in_bytes": 9788964,
"version_map_memory_in_bytes": 290304,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 529724,
"size_in_bytes": 275528684
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 84
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 4207454779,
"deleted": 0
},
"store": {
"size_in_bytes": 776849456528,
"throttle_time_in_millis": 0
},
"indexing": {
"index_total": 4207461365,
"index_time_in_millis": 333522565,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 2,
"time_in_millis": 13,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 2,
"missing_time_in_millis": 13,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 2046,
"query_time_in_millis": 4439867,
"query_current": 0,
"fetch_total": 204,
"fetch_time_in_millis": 61910,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 9,
"current_docs": 90922106,
"current_size_in_bytes": 17436129588,
"total": 993305,
"total_time_in_millis": 889392309,
"total_docs": 25596362951,
"total_size_in_bytes": 5109527514241,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 622031369,
"total_auto_throttle_in_bytes": 47185920
},
"refresh": {
"total": 6870703,
"total_time_in_millis": 80442220,
"listeners": 0
},
"flush": {
"total": 4194,
"total_time_in_millis": 1542414
},
"warmer": {
"current": 0,
"total": 6874724,
"total_time_in_millis": 1048456
},
"query_cache": {
"memory_size_in_bytes": 428618904,
"total_count": 38315,
"hit_count": 3196,
"miss_count": 35119,
"cache_size": 371,
"cache_count": 438,
"evictions": 67
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 492,
"memory_in_bytes": 2604314152,
"terms_memory_in_bytes": 2194198429,
"stored_fields_memory_in_bytes": 375756256,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 94464,
"points_memory_in_bytes": 33422427,
"doc_values_memory_in_bytes": 842576,
"index_writer_memory_in_bytes": 22793264,
"version_map_memory_in_bytes": 853888,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 1591047,
"size_in_bytes": 827579505
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 345
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
}
}
}

elasticsearch aggregations out of memory on small subset of large index

I have an index called 'reporting', where we store different types of daily stats for each one of our users. We have around 2,000 users. Our index is about 200million documents # 40gb in size. We perform aggregations on this index for a given user's stats over a date-range.
In this case, we are performing a filtered 'bool' query and doing a terms match to filter by user id's (1 to 2 user-id's at a time) and a range match to filter by the date range. We have a bucket aggregation that groups them by user-id and a sub-aggregation that sums a single value for each bucket.
It kind of looks like this:
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"terms": {
"uid": [1,2,3]
}
},
{
"range": {
"d": {
"gte": "2014-10-01",
"lte": "2014-10-12"
}
}
}
]
}
}
}
},
"aggs": {
"group_by_user": {
"terms": {
"field": "uid",
"size": 0
},
"aggs": {
"spend": {
"sum": {
"field": "sp"
}
}
}
}
}
}
The problem is I'm hitting a circuit-breaker exception while running out of memory.
[Data too large, data for field [uid] would be larger than limit of [2802686361/2.6gb]];
We are running this on a 3 node cluster with 7.5gb of memory for each node; I can't help but feel like I'm doing something wrong with the query/filter. Any help or guidance would be much appreciated.
Edit: Adding output of _stats
{
"_shards": {
"total": 6,
"successful": 6,
"failed": 0
},
"_all": {
"primaries": {
"docs": {
"count": 212102401,
"deleted": 318328
},
"store": {
"size_in_bytes": 46498616525,
"throttle_time_in_millis": 94162
},
"indexing": {
"index_total": 9405119,
"index_time_in_millis": 3091378,
"index_current": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0
},
"get": {
"total": 2,
"time_in_millis": 22,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 2,
"missing_time_in_millis": 22,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 1611,
"query_time_in_millis": 489683,
"query_current": 0,
"fetch_total": 56,
"fetch_time_in_millis": 62,
"fetch_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 831,
"total_time_in_millis": 1228785,
"total_docs": 33098268,
"total_size_in_bytes": 7812950398
},
"refresh": {
"total": 4978,
"total_time_in_millis": 358409
},
"flush": {
"total": 29,
"total_time_in_millis": 8926
},
"warmer": {
"current": 0,
"total": 10852,
"total_time_in_millis": 2293
},
"filter_cache": {
"memory_size_in_bytes": 613970692,
"evictions": 33934
},
"id_cache": {
"memory_size_in_bytes": 0
},
"fielddata": {
"memory_size_in_bytes": 4045281152,
"evictions": 0
},
"percolate": {
"total": 0,
"time_in_millis": 0,
"current": 0,
"memory_size_in_bytes": -1,
"memory_size": "-1b",
"queries": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 95,
"memory_in_bytes": 1671534384,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0
},
"translog": {
"operations": 436449,
"size_in_bytes": 59595977
},
"suggest": {
"total": 0,
"time_in_millis": 0,
"current": 0
}
},
"total": {
"docs": {
"count": 424204629,
"deleted": 685198
},
"store": {
"size_in_bytes": 93177256029,
"throttle_time_in_millis": 1609799
},
"indexing": {
"index_total": 86978099,
"index_time_in_millis": 31607032,
"index_current": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0
},
"get": {
"total": 4,
"time_in_millis": 46,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 4,
"missing_time_in_millis": 46,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 4674,
"query_time_in_millis": 766372,
"query_current": 0,
"fetch_total": 114,
"fetch_time_in_millis": 133,
"fetch_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 7700,
"total_time_in_millis": 19175664,
"total_docs": 358907679,
"total_size_in_bytes": 82787257943
},
"refresh": {
"total": 34174,
"total_time_in_millis": 3192066
},
"flush": {
"total": 175,
"total_time_in_millis": 83934
},
"warmer": {
"current": 0,
"total": 76291,
"total_time_in_millis": 29435
},
"filter_cache": {
"memory_size_in_bytes": 1244975360,
"evictions": 79602
},
"id_cache": {
"memory_size_in_bytes": 0
},
"fielddata": {
"memory_size_in_bytes": 8267198587,
"evictions": 0
},
"percolate": {
"total": 0,
"time_in_millis": 0,
"current": 0,
"memory_size_in_bytes": -1,
"memory_size": "-1b",
"queries": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 192,
"memory_in_bytes": 3333325472,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0
},
"translog": {
"operations": 876208,
"size_in_bytes": 59595977
},
"suggest": {
"total": 0,
"time_in_millis": 0,
"current": 0
}
}
},
"indices": {
"reporting-stats": {
"primaries": {
"docs": {
"count": 212102401,
"deleted": 318328
},
"store": {
"size_in_bytes": 46498616525,
"throttle_time_in_millis": 94162
},
"indexing": {
"index_total": 9405119,
"index_time_in_millis": 3091378,
"index_current": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0
},
"get": {
"total": 2,
"time_in_millis": 22,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 2,
"missing_time_in_millis": 22,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 1611,
"query_time_in_millis": 489683,
"query_current": 0,
"fetch_total": 56,
"fetch_time_in_millis": 62,
"fetch_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 831,
"total_time_in_millis": 1228785,
"total_docs": 33098268,
"total_size_in_bytes": 7812950398
},
"refresh": {
"total": 4978,
"total_time_in_millis": 358409
},
"flush": {
"total": 29,
"total_time_in_millis": 8926
},
"warmer": {
"current": 0,
"total": 10852,
"total_time_in_millis": 2293
},
"filter_cache": {
"memory_size_in_bytes": 613970692,
"evictions": 33934
},
"id_cache": {
"memory_size_in_bytes": 0
},
"fielddata": {
"memory_size_in_bytes": 4045281152,
"evictions": 0
},
"percolate": {
"total": 0,
"time_in_millis": 0,
"current": 0,
"memory_size_in_bytes": -1,
"memory_size": "-1b",
"queries": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 95,
"memory_in_bytes": 1671534384,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0
},
"translog": {
"operations": 436449,
"size_in_bytes": 59595977
},
"suggest": {
"total": 0,
"time_in_millis": 0,
"current": 0
}
},
"total": {
"docs": {
"count": 424204629,
"deleted": 685198
},
"store": {
"size_in_bytes": 93177256029,
"throttle_time_in_millis": 1609799
},
"indexing": {
"index_total": 86978099,
"index_time_in_millis": 31607032,
"index_current": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0
},
"get": {
"total": 4,
"time_in_millis": 46,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 4,
"missing_time_in_millis": 46,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 4674,
"query_time_in_millis": 766372,
"query_current": 0,
"fetch_total": 114,
"fetch_time_in_millis": 133,
"fetch_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 7700,
"total_time_in_millis": 19175664,
"total_docs": 358907679,
"total_size_in_bytes": 82787257943
},
"refresh": {
"total": 34174,
"total_time_in_millis": 3192066
},
"flush": {
"total": 175,
"total_time_in_millis": 83934
},
"warmer": {
"current": 0,
"total": 76291,
"total_time_in_millis": 29435
},
"filter_cache": {
"memory_size_in_bytes": 1244975360,
"evictions": 79602
},
"id_cache": {
"memory_size_in_bytes": 0
},
"fielddata": {
"memory_size_in_bytes": 8267198587,
"evictions": 0
},
"percolate": {
"total": 0,
"time_in_millis": 0,
"current": 0,
"memory_size_in_bytes": -1,
"memory_size": "-1b",
"queries": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 192,
"memory_in_bytes": 3333325472,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0
},
"translog": {
"operations": 876208,
"size_in_bytes": 59595977
},
"suggest": {
"total": 0,
"time_in_millis": 0,
"current": 0
}
}
}
}
}

Resources