ElasticSearch之Analyze index disk usage API

本API用于分析、统计指定index当前占用的存储空间。

考虑到本特性目前仍然处于预览状态,因此使用方法、参数等可能会发生变化,或者未来也许会被删除。

本API暂时不建议在生产系统中使用。

命令样例如下:

shell 复制代码
curl -X POST "https://localhost:9200/testindex_001/_disk_usage?run_expensive_tasks=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"

执行结果的样例,如下:

shell 复制代码
{
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "testindex_001" : {
    "store_size" : "249b",
    "store_size_in_bytes" : 249,
    "all_fields" : {
      "total" : "0b",
      "total_in_bytes" : 0,
      "inverted_index" : {
        "total" : "0b",
        "total_in_bytes" : 0
      },
      "stored_fields" : "0b",
      "stored_fields_in_bytes" : 0,
      "doc_values" : "0b",
      "doc_values_in_bytes" : 0,
      "points" : "0b",
      "points_in_bytes" : 0,
      "norms" : "0b",
      "norms_in_bytes" : 0,
      "term_vectors" : "0b",
      "term_vectors_in_bytes" : 0,
      "knn_vectors" : "0b",
      "knn_vectors_in_bytes" : 0
    },
    "fields" : { }
  }
}

方法参数
ignore_unavailable,默认值为false

  • true,本操作执行时跳过失效或者不可用的index

  • false,本操作执行时,遇到失效或者不可用的index,则报错,样例如下:

    shell 复制代码
    {
      "error" : {
          "root_cause" : [
          {
              "type" : "index_not_found_exception",
              "reason" : "no such index [testindex_002]",
              "resource.type" : "index_or_alias",
              "resource.id" : "testindex_002",
              "index_uuid" : "_na_",
              "index" : "testindex_002"
          }
          ],
          "type" : "index_not_found_exception",
          "reason" : "no such index [testindex_002]",
          "resource.type" : "index_or_alias",
          "resource.id" : "testindex_002",
          "index_uuid" : "_na_",
          "index" : "testindex_002"
      },
      "status" : 404
    }

wait_for_active_shards,默认值为1,即主副本。

执行本操作时,必须处于可用状态的副本的数量。

run_expensive_tasks,默认值为false

计算空间占用率的操作需要消耗大量的资源。

  • true,执行运算操作。

  • false,提示错误,样例如下:

    shell 复制代码
    {
      "error" : {
          "root_cause" : [
          {
              "type" : "illegal_argument_exception",
              "reason" : "analyzing the disk usage of an index is expensive and resource-intensive, the parameter [run_expensive_tasks] must be set to [true] in order for the task to be performed."
          }
          ],
          "type" : "illegal_argument_exception",
          "reason" : "analyzing the disk usage of an index is expensive and resource-intensive, the parameter [run_expensive_tasks] must be set to [true] in order for the task to be performed."
      },
      "status" : 400
    }

相关资料

相关推荐
007php00720 分钟前
go语言zero框架拉取内部平台开发的sdk报错的修复与实践
大数据·elasticsearch·搜索引擎
IT小饕餮1 小时前
linux系统安全
linux·运维·系统安全
小峰编程1 小时前
Python数据类型进阶——详解
linux·运维·服务器·开发语言·python·pycharm·swift
掘了2 小时前
C++ 程序员应该了解的 Linux 命令
linux·c++·后端
Elasticsearch2 小时前
Elasticsearch:语义文本 - 更简单、更好、更精炼、更强大 8.18
elasticsearch
安於宿命2 小时前
【Linux】线程
linux·服务器·信息与通信
芷栀夏2 小时前
零成本本地化搭建开源AI神器LocalAI支持CPU推理运行部署方案
linux·人工智能·ai·开源
c无序2 小时前
【Linux-传输层协议TCP】TCP协议段格式+确认应答+超时重传+连接管理机制(三次握手、四次挥手、理解TIME_WAIT + CLOSE_WAIT)
linux·网络·tcp/ip
SaebaRyo2 小时前
使用Nestjs + ElasticSearch实现电商搜索功能
后端·elasticsearch·nestjs
卡卡东~3 小时前
JConsole 在 Linux 上的使用
linux·服务器