ElasticSearch 获取索引名称和存储大小
ElasticSearch Get Index Names and Store Size
我正在尝试捕获所有索引及其大小的列表,以便我可以使用 Angular 的 $http 服务捕获信息,然后使用 ng-repeat 遍历信息最好是类似的东西:
<ul ng-repeat="elsindex in elsIndexHttpResponse">
<li>{{elsindex.name}}:{{elsindex.size}}</li>
</ul>
我发现的最接近的是:
http://localhost:9200/_cat/indices?h=index,store.size
除了:
一个。它的响应不在 json 中,因此使用 ng-repeat <li>
元素轻松引用它是行不通的;和
b。如果可能的话,我希望获得大小输出以反映相同的单位大小(如字节)。
如果这涉及到一些复杂的事情,那么我将不胜感激,请指点我应该关注的地方。
我正在使用 elasticsearch v1.4.4
非常感谢
中包含以字节为单位的索引大小
curl http://localhost:9200/_stats/indexing,store
对于格式良好的 JSON 输出,将 ?pretty 附加到 URL 的末尾:
curl http://localhost:9200/_stats/indexing,store?pretty
有关其他详细信息和相关信息,请参阅 Indices stats API documentation。
我意识到这个问题已经过时了,但我想加 2 美分。
http://localhost:9200/_cat/indices?h=index,store.size&bytes=kb&format=json
实际上会得到你所要求的:
- format=json -> 将输出格式化为 json
- bytes=kb -> 以千字节为单位输出大小
有关尺寸单位的信息是从 cat APIs doc
中检索到的
Possible values 用于字节参数
有关格式的信息是 Sense 中的一次尝试,它具有一些自动完成功能,对于检测此类选项非常有用。
干杯。
只是对上述答案稍作修改。
curl -X GET "localhost:9200/_cat/indices?h=index,store.size&bytes=gb?pretty"
如果您需要特定索引的大小,下面的 API 在 Elastic Search 7.14 上运行良好。
curl http://10.29.61.105:9200/employee/_stats
其中 employee 是所需的索引名称。
我正在尝试捕获所有索引及其大小的列表,以便我可以使用 Angular 的 $http 服务捕获信息,然后使用 ng-repeat 遍历信息最好是类似的东西:
<ul ng-repeat="elsindex in elsIndexHttpResponse">
<li>{{elsindex.name}}:{{elsindex.size}}</li>
</ul>
我发现的最接近的是: http://localhost:9200/_cat/indices?h=index,store.size
除了:
一个。它的响应不在 json 中,因此使用 ng-repeat <li>
元素轻松引用它是行不通的;和
b。如果可能的话,我希望获得大小输出以反映相同的单位大小(如字节)。
如果这涉及到一些复杂的事情,那么我将不胜感激,请指点我应该关注的地方。
我正在使用 elasticsearch v1.4.4
非常感谢
curl http://localhost:9200/_stats/indexing,store
对于格式良好的 JSON 输出,将 ?pretty 附加到 URL 的末尾:
curl http://localhost:9200/_stats/indexing,store?pretty
有关其他详细信息和相关信息,请参阅 Indices stats API documentation。
我意识到这个问题已经过时了,但我想加 2 美分。
http://localhost:9200/_cat/indices?h=index,store.size&bytes=kb&format=json
实际上会得到你所要求的:
- format=json -> 将输出格式化为 json
- bytes=kb -> 以千字节为单位输出大小
有关尺寸单位的信息是从 cat APIs doc
中检索到的Possible values 用于字节参数
有关格式的信息是 Sense 中的一次尝试,它具有一些自动完成功能,对于检测此类选项非常有用。
干杯。
只是对上述答案稍作修改。
curl -X GET "localhost:9200/_cat/indices?h=index,store.size&bytes=gb?pretty"
如果您需要特定索引的大小,下面的 API 在 Elastic Search 7.14 上运行良好。
curl http://10.29.61.105:9200/employee/_stats
其中 employee 是所需的索引名称。