我使用Elasticsearch1.7.3,根据文档的indices-stats章节,可以进行type level stats。
参数:indexing
Indexing statistics, can be combined with a comma separated list of types to provide document type level stats.
例子:
curl 'localhost:9200/my_index/_stats?clear=true&indexing=true&types=type1,type2'
可是这个例子我试了下返回结构就是跟localhost:9200/my_index/_stats/indexing是一样的,也就是说types参数完全没有起到作用,求问这个api到底怎么用?
另外说下我的需求,看看有没有别的方式可以实现的:
一个index下有99个type,现在想统计每个type下的数据量。
求大神解救!
找到答案了。
1) api是没有问题的,可以用,当时我本地的idnexing有问题,所有返回都是0。
不过这个api返回的是索引的状况,并不是我想要的doc统计。
2) 使用aggs
使用aggs统计_type字段即可。