ElasticSearch之Index stats API

2023-12-07 09:04
文章标签 elasticsearch api index stats

本文主要是介绍ElasticSearch之Index stats API,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

获取指定索引的统计数据。

获取指定索引的全部统计数据,命令样例如下:

curl -X GET "https://localhost:9200/testindex_001/_stats?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"

执行结果的样例,如下:

{"_shards" : {"total" : 2,"successful" : 1,"failed" : 0},"_all" : {"primaries" : {"docs" : {"count" : 0,"deleted" : 0},"shard_stats" : {"total_count" : 1},"store" : {"size_in_bytes" : 249,"total_data_set_size_in_bytes" : 249,"reserved_in_bytes" : 0},"indexing" : {"index_total" : 0,"index_time_in_millis" : 0,"index_current" : 0,"index_failed" : 0,"delete_total" : 0,"delete_time_in_millis" : 0,"delete_current" : 0,"noop_update_total" : 0,"is_throttled" : false,"throttle_time_in_millis" : 0,"write_load" : 0.0},"get" : {"total" : 0,"time_in_millis" : 0,"exists_total" : 0,"exists_time_in_millis" : 0,"missing_total" : 0,"missing_time_in_millis" : 0,"current" : 0},"search" : {"open_contexts" : 0,"query_total" : 0,"query_time_in_millis" : 0,"query_current" : 0,"fetch_total" : 0,"fetch_time_in_millis" : 0,"fetch_current" : 0,"scroll_total" : 0,"scroll_time_in_millis" : 0,"scroll_current" : 0,"suggest_total" : 0,"suggest_time_in_millis" : 0,"suggest_current" : 0},"merges" : {"current" : 0,"current_docs" : 0,"current_size_in_bytes" : 0,"total" : 0,"total_time_in_millis" : 0,"total_docs" : 0,"total_size_in_bytes" : 0,"total_stopped_time_in_millis" : 0,"total_throttled_time_in_millis" : 0,"total_auto_throttle_in_bytes" : 20971520},"refresh" : {"total" : 8,"total_time_in_millis" : 50,"external_total" : 5,"external_total_time_in_millis" : 52,"listeners" : 0},"flush" : {"total" : 1,"periodic" : 1,"total_time_in_millis" : 174},"warmer" : {"current" : 0,"total" : 4,"total_time_in_millis" : 1},"query_cache" : {"memory_size_in_bytes" : 0,"total_count" : 0,"hit_count" : 0,"miss_count" : 0,"cache_size" : 0,"cache_count" : 0,"evictions" : 0},"fielddata" : {"memory_size_in_bytes" : 0,"evictions" : 0,"global_ordinals" : {"build_time_in_millis" : 0}},"completion" : {"size_in_bytes" : 0},"segments" : {"count" : 0,"memory_in_bytes" : 0,"terms_memory_in_bytes" : 0,"stored_fields_memory_in_bytes" : 0,"term_vectors_memory_in_bytes" : 0,"norms_memory_in_bytes" : 0,"points_memory_in_bytes" : 0,"doc_values_memory_in_bytes" : 0,"index_writer_memory_in_bytes" : 0,"version_map_memory_in_bytes" : 0,"fixed_bit_set_memory_in_bytes" : 0,"max_unsafe_auto_id_timestamp" : -1,"file_sizes" : { }},"translog" : {"operations" : 0,"size_in_bytes" : 55,"uncommitted_operations" : 0,"uncommitted_size_in_bytes" : 55,"earliest_last_modified_age" : 26213582},"request_cache" : {"memory_size_in_bytes" : 0,"evictions" : 0,"hit_count" : 0,"miss_count" : 0},"recovery" : {"current_as_source" : 0,"current_as_target" : 0,"throttle_time_in_millis" : 0},"bulk" : {"total_operations" : 0,"total_time_in_millis" : 0,"total_size_in_bytes" : 0,"avg_time_in_millis" : 0,"avg_size_in_bytes" : 0},"dense_vector" : {"value_count" : 0}},"total" : {"docs" : {"count" : 0,"deleted" : 0},"shard_stats" : {"total_count" : 1},"store" : {"size_in_bytes" : 249,"total_data_set_size_in_bytes" : 249,"reserved_in_bytes" : 0},"indexing" : {"index_total" : 0,"index_time_in_millis" : 0,"index_current" : 0,"index_failed" : 0,"delete_total" : 0,"delete_time_in_millis" : 0,"delete_current" : 0,"noop_update_total" : 0,"is_throttled" : false,"throttle_time_in_millis" : 0,"write_load" : 0.0},"get" : {"total" : 0,"time_in_millis" : 0,"exists_total" : 0,"exists_time_in_millis" : 0,"missing_total" : 0,"missing_time_in_millis" : 0,"current" : 0},"search" : {"open_contexts" : 0,"query_total" : 0,"query_time_in_millis" : 0,"query_current" : 0,"fetch_total" : 0,"fetch_time_in_millis" : 0,"fetch_current" : 0,"scroll_total" : 0,"scroll_time_in_millis" : 0,"scroll_current" : 0,"suggest_total" : 0,"suggest_time_in_millis" : 0,"suggest_current" : 0},"merges" : {"current" : 0,"current_docs" : 0,"current_size_in_bytes" : 0,"total" : 0,"total_time_in_millis" : 0,"total_docs" : 0,"total_size_in_bytes" : 0,"total_stopped_time_in_millis" : 0,"total_throttled_time_in_millis" : 0,"total_auto_throttle_in_bytes" : 20971520},"refresh" : {"total" : 8,"total_time_in_millis" : 50,"external_total" : 5,"external_total_time_in_millis" : 52,"listeners" : 0},"flush" : {"total" : 1,"periodic" : 1,"total_time_in_millis" : 174},"warmer" : {"current" : 0,"total" : 4,"total_time_in_millis" : 1},"query_cache" : {"memory_size_in_bytes" : 0,"total_count" : 0,"hit_count" : 0,"miss_count" : 0,"cache_size" : 0,"cache_count" : 0,"evictions" : 0},"fielddata" : {"memory_size_in_bytes" : 0,"evictions" : 0,"global_ordinals" : {"build_time_in_millis" : 0}},"completion" : {"size_in_bytes" : 0},"segments" : {"count" : 0,"memory_in_bytes" : 0,"terms_memory_in_bytes" : 0,"stored_fields_memory_in_bytes" : 0,"term_vectors_memory_in_bytes" : 0,"norms_memory_in_bytes" : 0,"points_memory_in_bytes" : 0,"doc_values_memory_in_bytes" : 0,"index_writer_memory_in_bytes" : 0,"version_map_memory_in_bytes" : 0,"fixed_bit_set_memory_in_bytes" : 0,"max_unsafe_auto_id_timestamp" : -1,"file_sizes" : { }},"translog" : {"operations" : 0,"size_in_bytes" : 55,"uncommitted_operations" : 0,"uncommitted_size_in_bytes" : 55,"earliest_last_modified_age" : 26213582},"request_cache" : {"memory_size_in_bytes" : 0,"evictions" : 0,"hit_count" : 0,"miss_count" : 0},"recovery" : {"current_as_source" : 0,"current_as_target" : 0,"throttle_time_in_millis" : 0},"bulk" : {"total_operations" : 0,"total_time_in_millis" : 0,"total_size_in_bytes" : 0,"avg_time_in_millis" : 0,"avg_size_in_bytes" : 0},"dense_vector" : {"value_count" : 0}}},"indices" : {"testindex_001" : {"uuid" : "7iGJRFfxRd2jD3qP-KDRmQ","health" : "yellow","status" : "open","primaries" : {"docs" : {"count" : 0,"deleted" : 0},"shard_stats" : {"total_count" : 1},"store" : {"size_in_bytes" : 249,"total_data_set_size_in_bytes" : 249,"reserved_in_bytes" : 0},"indexing" : {"index_total" : 0,"index_time_in_millis" : 0,"index_current" : 0,"index_failed" : 0,"delete_total" : 0,"delete_time_in_millis" : 0,"delete_current" : 0,"noop_update_total" : 0,"is_throttled" : false,"throttle_time_in_millis" : 0,"write_load" : 0.0},"get" : {"total" : 0,"time_in_millis" : 0,"exists_total" : 0,"exists_time_in_millis" : 0,"missing_total" : 0,"missing_time_in_millis" : 0,"current" : 0},"search" : {"open_contexts" : 0,"query_total" : 0,"query_time_in_millis" : 0,"query_current" : 0,"fetch_total" : 0,"fetch_time_in_millis" : 0,"fetch_current" : 0,"scroll_total" : 0,"scroll_time_in_millis" : 0,"scroll_current" : 0,"suggest_total" : 0,"suggest_time_in_millis" : 0,"suggest_current" : 0},"merges" : {"current" : 0,"current_docs" : 0,"current_size_in_bytes" : 0,"total" : 0,"total_time_in_millis" : 0,"total_docs" : 0,"total_size_in_bytes" : 0,"total_stopped_time_in_millis" : 0,"total_throttled_time_in_millis" : 0,"total_auto_throttle_in_bytes" : 20971520},"refresh" : {"total" : 8,"total_time_in_millis" : 50,"external_total" : 5,"external_total_time_in_millis" : 52,"listeners" : 0},"flush" : {"total" : 1,"periodic" : 1,"total_time_in_millis" : 174},"warmer" : {"current" : 0,"total" : 4,"total_time_in_millis" : 1},"query_cache" : {"memory_size_in_bytes" : 0,"total_count" : 0,"hit_count" : 0,"miss_count" : 0,"cache_size" : 0,"cache_count" : 0,"evictions" : 0},"fielddata" : {"memory_size_in_bytes" : 0,"evictions" : 0,"global_ordinals" : {"build_time_in_millis" : 0}},"completion" : {"size_in_bytes" : 0},"segments" : {"count" : 0,"memory_in_bytes" : 0,"terms_memory_in_bytes" : 0,"stored_fields_memory_in_bytes" : 0,"term_vectors_memory_in_bytes" : 0,"norms_memory_in_bytes" : 0,"points_memory_in_bytes" : 0,"doc_values_memory_in_bytes" : 0,"index_writer_memory_in_bytes" : 0,"version_map_memory_in_bytes" : 0,"fixed_bit_set_memory_in_bytes" : 0,"max_unsafe_auto_id_timestamp" : -1,"file_sizes" : { }},"translog" : {"operations" : 0,"size_in_bytes" : 55,"uncommitted_operations" : 0,"uncommitted_size_in_bytes" : 55,"earliest_last_modified_age" : 26213582},"request_cache" : {"memory_size_in_bytes" : 0,"evictions" : 0,"hit_count" : 0,"miss_count" : 0},"recovery" : {"current_as_source" : 0,"current_as_target" : 0,"throttle_time_in_millis" : 0},"bulk" : {"total_operations" : 0,"total_time_in_millis" : 0,"total_size_in_bytes" : 0,"avg_time_in_millis" : 0,"avg_size_in_bytes" : 0},"dense_vector" : {"value_count" : 0}},"total" : {"docs" : {"count" : 0,"deleted" : 0},"shard_stats" : {"total_count" : 1},"store" : {"size_in_bytes" : 249,"total_data_set_size_in_bytes" : 249,"reserved_in_bytes" : 0},"indexing" : {"index_total" : 0,"index_time_in_millis" : 0,"index_current" : 0,"index_failed" : 0,"delete_total" : 0,"delete_time_in_millis" : 0,"delete_current" : 0,"noop_update_total" : 0,"is_throttled" : false,"throttle_time_in_millis" : 0,"write_load" : 0.0},"get" : {"total" : 0,"time_in_millis" : 0,"exists_total" : 0,"exists_time_in_millis" : 0,"missing_total" : 0,"missing_time_in_millis" : 0,"current" : 0},"search" : {"open_contexts" : 0,"query_total" : 0,"query_time_in_millis" : 0,"query_current" : 0,"fetch_total" : 0,"fetch_time_in_millis" : 0,"fetch_current" : 0,"scroll_total" : 0,"scroll_time_in_millis" : 0,"scroll_current" : 0,"suggest_total" : 0,"suggest_time_in_millis" : 0,"suggest_current" : 0},"merges" : {"current" : 0,"current_docs" : 0,"current_size_in_bytes" : 0,"total" : 0,"total_time_in_millis" : 0,"total_docs" : 0,"total_size_in_bytes" : 0,"total_stopped_time_in_millis" : 0,"total_throttled_time_in_millis" : 0,"total_auto_throttle_in_bytes" : 20971520},"refresh" : {"total" : 8,"total_time_in_millis" : 50,"external_total" : 5,"external_total_time_in_millis" : 52,"listeners" : 0},"flush" : {"total" : 1,"periodic" : 1,"total_time_in_millis" : 174},"warmer" : {"current" : 0,"total" : 4,"total_time_in_millis" : 1},"query_cache" : {"memory_size_in_bytes" : 0,"total_count" : 0,"hit_count" : 0,"miss_count" : 0,"cache_size" : 0,"cache_count" : 0,"evictions" : 0},"fielddata" : {"memory_size_in_bytes" : 0,"evictions" : 0,"global_ordinals" : {"build_time_in_millis" : 0}},"completion" : {"size_in_bytes" : 0},"segments" : {"count" : 0,"memory_in_bytes" : 0,"terms_memory_in_bytes" : 0,"stored_fields_memory_in_bytes" : 0,"term_vectors_memory_in_bytes" : 0,"norms_memory_in_bytes" : 0,"points_memory_in_bytes" : 0,"doc_values_memory_in_bytes" : 0,"index_writer_memory_in_bytes" : 0,"version_map_memory_in_bytes" : 0,"fixed_bit_set_memory_in_bytes" : 0,"max_unsafe_auto_id_timestamp" : -1,"file_sizes" : { }},"translog" : {"operations" : 0,"size_in_bytes" : 55,"uncommitted_operations" : 0,"uncommitted_size_in_bytes" : 55,"earliest_last_modified_age" : 26213582},"request_cache" : {"memory_size_in_bytes" : 0,"evictions" : 0,"hit_count" : 0,"miss_count" : 0},"recovery" : {"current_as_source" : 0,"current_as_target" : 0,"throttle_time_in_millis" : 0},"bulk" : {"total_operations" : 0,"total_time_in_millis" : 0,"total_size_in_bytes" : 0,"avg_time_in_millis" : 0,"avg_size_in_bytes" : 0},"dense_vector" : {"value_count" : 0}}}}
}

获取指定索引的指定指标的统计数据,命令样例如下:

curl -X GET "https://localhost:9200/testindex_001/_stats/completion?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"

执行结果的样例,如下:

{"_shards" : {"total" : 2,"successful" : 1,"failed" : 0},"_all" : {"primaries" : {"completion" : {"size_in_bytes" : 0}},"total" : {"completion" : {"size_in_bytes" : 0}}},"indices" : {"testindex_001" : {"uuid" : "7iGJRFfxRd2jD3qP-KDRmQ","health" : "yellow","status" : "open","primaries" : {"completion" : {"size_in_bytes" : 0}},"total" : {"completion" : {"size_in_bytes" : 0}}}}
}

允许指定的指标,如下:

  • _all,默认值,即全部指标,无需显式指定。
  • completion
  • docs
  • fielddata
  • flush
  • get
  • indexing
  • merge
  • query_cache
  • refresh
  • request_cache
  • search
  • segments
  • store
  • translog

方法参数
level,指标的统计级别,可选值:

  • cluster
  • indices
  • shards

相关资料

  • Index stats API
  • Suggesters
  • Refresh API
  • Text type family
  • Flush API
  • Index API
  • Merge
  • Shard request cache settings
  • Translog

这篇关于ElasticSearch之Index stats API的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/465278

相关文章

基于MySQL Binlog的Elasticsearch数据同步实践

一、为什么要做 随着马蜂窝的逐渐发展,我们的业务数据越来越多,单纯使用 MySQL 已经不能满足我们的数据查询需求,例如对于商品、订单等数据的多维度检索。 使用 Elasticsearch 存储业务数据可以很好的解决我们业务中的搜索需求。而数据进行异构存储后,随之而来的就是数据同步的问题。 二、现有方法及问题 对于数据同步,我们目前的解决方案是建立数据中间表。把需要检索的业务数据,统一放到一张M

【LabVIEW学习篇 - 21】:DLL与API的调用

文章目录 DLL与API调用DLLAPIDLL的调用 DLL与API调用 LabVIEW虽然已经足够强大,但不同的语言在不同领域都有着自己的优势,为了强强联合,LabVIEW提供了强大的外部程序接口能力,包括DLL、CIN(C语言接口)、ActiveX、.NET、MATLAB等等。通过DLL可以使用户很方便地调用C、C++、C#、VB等编程语言写的程序以及windows自带的大

如何更优雅地对接第三方API

如何更优雅地对接第三方API 本文所有示例完整代码地址:https://github.com/yu-linfeng/BlogRepositories/tree/master/repositories/third 我们在日常开发过程中,有不少场景会对接第三方的API,例如第三方账号登录,第三方服务等等。第三方服务会提供API或者SDK,我依稀记得早些年Maven还没那么广泛使用,通常要对接第三方

Java基础回顾系列-第五天-高级编程之API类库

Java基础回顾系列-第五天-高级编程之API类库 Java基础类库StringBufferStringBuilderStringCharSequence接口AutoCloseable接口RuntimeSystemCleaner对象克隆 数字操作类Math数学计算类Random随机数生成类BigInteger/BigDecimal大数字操作类 日期操作类DateSimpleDateForma

Restful API 原理以及实现

先说说API 再说啥是RESRFUL API之前,咱先说说啥是API吧。API大家应该都知道吧,简称接口嘛。随着现在移动互联网的火爆,手机软件,也就是APP几乎快爆棚了。几乎任何一个网站或者应用都会出一款iOS或者Android APP,相比网页版的体验,APP确实各方面性能要好很多。 那么现在问题来了。比如QQ空间网站,如果我想获取一个用户发的说说列表。 QQ空间网站里面需要这个功能。

京东物流查询|开发者调用API接口实现

快递聚合查询的优势 1、高效整合多种快递信息。2、实时动态更新。3、自动化管理流程。 聚合国内外1500家快递公司的物流信息查询服务,使用API接口查询京东物流的便捷步骤,首先选择专业的数据平台的快递API接口:物流快递查询API接口-单号查询API - 探数数据 以下示例是参考的示例代码: import requestsurl = "http://api.tanshuapi.com/a

WordPress开发中常用的工具或api文档

http://php.net/ http://httpd.apache.org/ https://wordpress.org/ https://cn.wordpress.org/ https://core.svn.wordpress.org/ zh-cn:开发者文档: https://codex.wordpress.org/zh-cn:%E5%BC%80%E5%8F%91%E8%80%

Java后端微服务架构下的API限流策略:Guava RateLimiter

Java后端微服务架构下的API限流策略:Guava RateLimiter 大家好,我是微赚淘客返利系统3.0的小编,是个冬天不穿秋裤,天冷也要风度的程序猿! 在微服务架构中,API限流是保护服务不受过度使用和拒绝服务攻击的重要手段。Guava RateLimiter是Google开源的Java库中的一个组件,提供了简单易用的限流功能。 API限流概述 API限流通过控制请求的速率来防止

ElasticSearch的DSL查询⑤(ES数据聚合、DSL语法数据聚合、RestClient数据聚合)

目录 一、数据聚合 1.1 DSL实现聚合 1.1.1 Bucket聚合  1.1.2 带条件聚合 1.1.3 Metric聚合 1.1.4 总结 2.1 RestClient实现聚合 2.1.1 Bucket聚合 2.1.2 带条件聚合 2.2.3 Metric聚合 一、数据聚合 聚合(aggregations)可以让我们极其方便的实现对数据的统计、分析、运算。例如:

Docker远程连接和Docker Remote Api

在Docker生态系统中一共有3种API:Registry API、Docker Hub API、Docker Remote API 这三种API都是RESTful风格的。这里Remote API是通过程序与Docker进行集成和交互的核心内容。 Docker Remote API是由Docker守护进程提供的。默认情况下,Docker守护进程会绑定到一个所在宿主机的套接字:unix:///v