The indices
tab in Kibana Monitoring UI shows the indexing rate:
Can anyone guide me on how can I get that programatically using API? Based on this thread as well as this, it seems I can do the following:
GET /.monitoring-es-6-2021.01.20/_search?sort=timestamp:desc&filter_path=**.primaries.indexing&size=2
{
"query": {
"bool": {
"filter": [
{
"term": {
"index_stats.index": "my_index"
}
}
]
}
}
}
This will output something like:
{
"hits" : {
...
"indexing" : {
"index_total" : 54527554,
"index_time_in_millis" : 6592199,
...
},
{
...
"indexing" : {
"index_total" : 54315000,
"index_time_in_millis" : 6564685,
...
}
I suppose I can calculate the indexing rate as (index_total_1 - index_total_2) / (index_time_in_seconds_1-index_time_in_seconds_2)
i.e ( 54527554-54315000)/(6592.199-6564.685)
= 7725.30/s
Is this the correct way or a better / shorter way exists?
Thanks.