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

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

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

命令样例如下:

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"

执行结果的样例,如下:

{
"_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,则报错,样例如下:
    {
    "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,提示错误,样例如下:
    {
    "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
    }

相关资料

ElasticSearch之Analyze index disk usage API的更多相关文章

  1. 应用alter index ××× monitoring usage;语句监控索引使用与否

    随着时间的累积,在没有很好的规划的情况下,数据库中也许会存在大量长期不被使用的索引,如果快速的定位这些索引以便清理便摆在案头.我们可以使用"alter index ××× monitorin ...

  2. ElasticSearch查询 第一篇:搜索API

    <ElasticSearch查询>目录导航: ElasticSearch查询 第一篇:搜索API ElasticSearch查询 第二篇:文档更新 ElasticSearch查询 第三篇: ...

  3. Elasticsearch入坑指南之RESTful API

    Elasticsearch入坑指南之RESTful API Tags:Elasticsearch ES为开发者提供了非常丰富的基于Http协议的Rest API,通过简单的Rest请求,就可以实现非常 ...

  4. 10 Useful du (Disk Usage) Commands to Find Disk Usage of Files and Directories

    The Linux “du” (Disk Usage) is a standard Unix/Linux command, used to check the information of disk ...

  5. WinDirStat is a disk usage statistics viewer

    WinDirStat is a disk usage statistics viewer and cleanup tool for various versions of Microsoft Wind ...

  6. elasticsearch使用Analyze API

    curl -XGET 'localhost:9200/index_name/_analyze?pretty&field=type_name.field_name' -d 'Robots car ...

  7. Elasticsearch:Split index API - 把一个大的索引分拆成更多分片

    文章转载自:https://blog.csdn.net/UbuntuTouch/article/details/108960950

  8. 分布式搜索引擎Elasticsearch PHP类封装 使用原生api

    //官方的 php  api写的鸡肋了,下面这个类可以使用 es api 操作. <?php class ElasticSearch { public $index; function __co ...

  9. Swiper Usage&&API

    最近使用Swipe.js,发现中文的资料很少,试着翻译了一下.能力有限,翻译难免错漏,请指出,多谢!如果想获得国外较多而全的文档,还是用google. 一了解SwiperSwiper 是一款免费以及轻 ...

  10. Elasticsearch 5.4.3实战--Java API调用:索引mapping创建

    因为项目开发使用的是Java语言, 项目的开发架构是Spring MVC+ maven的jar包管理,  所以今天重点说说ES 5.4.3 的Java API的源码实战 1. pom.xml文件增加依 ...

随机推荐

  1. .NET C#基础(9):资源释放 - 需要介入的资源管理

    1. 什么是IDisposable?   IDisposable接口是一个用于约定可进行释放资源操作的接口,一个类实现该接口则意味着可以使用接口约定的方法Dispose来释放资源.其定义如下: pub ...

  2. c语言代码练习7

    //输出0-100的三倍数字#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> int main() { int i = 0; int ...

  3. .NET 数据库大数据 方案(插入、更新、删除、查询 、插入或更新)

    1.功能介绍 (需要版本5.0.45) 海量数据操作ORM性能瓶颈在实体转换上面,并且不能使用常规的Sql去实现 当列越多转换越慢,SqlSugar将转换性能做到极致,并且采用数据库最佳API 操作数 ...

  4. 一行代码搞定 font-size 响应式

    前言 公司要做大屏,但是大屏还要有个嵌在系统的版本,屏幕(iframe)小了但字体大了怎么办.网上找了很多代码都很长,个人参考了资料后实现了一个一行代码 font-size 响应式. TL;DR ht ...

  5. CF1877 Div2 A-E 题解

    A 显然 \(n\) 个队的得分之和为 \(0\),因此答案为这 \(n-1\) 个数的和的相反数. 赛时代码 B 小贪心. 将所有人按 \(b\) 升序排序,\(b\) 相同时按 \(a\) 降序, ...

  6. 给wordpress后台侧栏菜单添加自定义字段的方法

    我们在使用wordpress做网站的时候,难免有一些需要在后台设置侧栏菜单下添加自定义字段的情况.下面就简单说说一下,如何在后台设置侧栏菜单下添加自定义字段? 在这里我们主要是使用wordpress的 ...

  7. 17.1 隐藏执行CMD命令

    本章内容涉及使用Socket API和CMD命令行工具实现本地CMD命令执行.无管道正向CMD和无管道反向CMD三种功能.执行本地CMD实现使用CreateProcess函数创建一个新的CMD进程,并 ...

  8. C#经典十大排序算法(完结)

    C#冒泡排序算法 简介 冒泡排序算法是一种基础的排序算法,它的实现原理比较简单.核心思想是通过相邻元素的比较和交换来将最大(或最小)的元素逐步"冒泡"到数列的末尾. 详细文章描述 ...

  9. select...for update到底是加了行锁,还是表锁?

    前言 前几天,知识星球中的一个小伙伴,问了我一个问题:在MySQL中,事务A中使用select...for update where id=1锁住了,某一条数据,事务还没提交,此时,事务B中去用sel ...

  10. 以太坊和比特币区块链的异同(一些QA)

    1.比特币区块链和以太坊区块链有何区别? 比特币区块链与以太坊在设计和功能上有显著的不同.下面是关于比特币的主要点: 没有智能合约功能(按照以太坊的定义):比特币是为了作为一个去中心化的数字货币而创建 ...