ElasticSearch:查找索引的索引率

jxct1oxe  于 2022-12-03  发布在  ElasticSearch
关注(0)|答案(1)|浏览(196)

我很想知道在一个特定的索引中有多少文档被索引(创建/更新)。我看了_stats api,但是没有什么意义。有人能告诉我如何计算索引率吗?它可以是每秒/分钟。谢谢

ercv8c1e

ercv8c1e1#

Elasticsearch并不直接提供这些数据,但你对API的看法是正确的。
_stat API上,您必须查看索引操作的总数(自服务器启动以来)并存储调用它的时间:

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

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

稍后,您将需要对同一API进行第二次调用:

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

再经过一些计算,您将得到您的指数化率:

  • 第一次呼叫时间为12:00:00 =〉555
  • 12:01:00第二次呼叫=〉666
  • 索引编制速率为每分钟111个文档。

相关问题