ElasticSearch:查找索引的索引率

Fiz*_*izi 3 elasticsearch

我想知道在特定索引中索引(创建/更新)了多少文档。我查看了 _stats api,但没有多大意义。谁能告诉我如何计算索引率。它可以是每秒/分钟。谢谢

Dam*_*ien 6

Elasticsearch 不直接提供这些数据,但您对 API 的看法是正确的。

_statAPI 上,您必须查看索引操作的总数(自服务器启动以来)并存储调用它的时间:

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

{
  "indices": {
    "index_name_here": {
      "total": {
        "indexing": {
          "index_total": 555
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

有时层,您将需要对相同的 API 进行第二次调用:

{
  "indices": {
    "index_name_here": {
      "total": {
        "indexing": {
          "index_total": 666
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

通过一些计算,您将获得索引率:

  • 12:00:00 的第一次呼叫 => 555
  • 12:01:00 第二次调用 => 666
  • 索引速度为每分钟111 个文档。