Fizi
Fizi

Reputation: 1861

ElasticSearch: Find the indexing rate of an index

I am interested in knowing how many documents are being indexed (created/updated) within a particular index. I looked at the _stats api but could not make much sense out of it. Can anyone please tell me how to figure out the indexing rate. It can be per second/minute. Thanks

Upvotes: 3

Views: 6765

Answers (1)

Damien
Damien

Reputation: 5882

Elasticsearch does not provide this data directly, but you are right about the API.

On the _stat API you will have to look at the total of index operation (since the server started) and store the time of when you call it:

GET _stats?filter_path=indices.index_name_here.total.indexing.index_total

{
  "indices": {
    "index_name_here": {
      "total": {
        "indexing": {
          "index_total": 555
        }
      }
    }
  }
}

Some times later, you will need to make a second call, to the same API:

{
  "indices": {
    "index_name_here": {
      "total": {
        "indexing": {
          "index_total": 666
        }
      }
    }
  }
}

And with a bit of calculation, you will have your indexing rate:

  • first call at 12:00:00 => 555
  • second call at 12:01:00 => 666
  • Indexing rate is 111 document per minute.

Upvotes: 7

Related Questions