Get Cluster Indexing Rate/Second via Rest API

Hello - we have cluster monitoring enabled, and can see the Search and Indexing Rates and Latencies graphs on the Cluster Overview page. We need to query some indication of indexing rate or ingestion rate for display in an external system.

"GET _stats" appears to have statistics, but we are unsure how to calculate Indexing Rate/second or Indexing Latency(ms) being displayed in Cluster Overview using those values? Assuming that monitoring a change rate in total documents will only work until ILM policies start cleaning up records?

Essentially looking for guidance on easiest way to get some indication of current overall indexing rate or ingestion rate into an external system (outside of Kibana). Any guidance or recommendations are appreciated!

Thanks!

I am guessing this would be monitoring the change over time for index stats (GET _stats) using _all.primaries.indexing.index_total and total.indexing.index_total . I am going to give that a try.