获取索引上的字段数 [英] Get the number of fields on an index

查看:73
本文介绍了获取索引上的字段数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于优化目的,我试图减少我的总字段数.但是在开始之前,我想了解一下我实际上有多少个字段.在_stats端点中似乎没有任何信息,而且我不太清楚迁移工具如何进行字段计数计算.

For optimization purposes, I am trying to cut down my total field count. However before I am going to do that I want to get an idea of how many fields I actually have. There doesn't seem to be any Information in the _stats endpoint and I can't quite figure out how the migration tool does its field count calculation.

是否可以通过某种端点或其他方式来获取指定索引的总字段数?

Is there some way, either with an endpoint or by other means, to get the total field count of a specified index?

推荐答案

要进一步提供其他答案,您可以获取映射,然后简单地计算关键字type在关键字中出现的次数.输出,它给出了字段数,因为每个字段都需要一种类型:

To build a bit further upon what the other answer provided, you can get the mapping and then simply count the number of times the keyword type appears in the output, which gives the number of fields since each field needs a type:

curl -s -XGET localhost:9200/index/_mapping?pretty | grep type | wc -l

这篇关于获取索引上的字段数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆