所有索引的 Elasticsearch 计数
Elasticsearch counts of all indices
正在尝试获取所有索引的计数。我在 URL 中使用 _all
。以下代码有效,但未返回所有索引的数据。
GET /_all/_search?search_type=count&q=_type:invoice
{
"aggs": {
"by_index": {
"terms": {
"field": "_index"
}
}
}
}
大多数索引在输出中被跳过。索引是否有限制或我的代码有问题?
是的,默认返回结果的限制是10个:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/_executing_aggregations.html.
To start with, this example groups all the accounts by state, and then returns the top 10 (default) states sorted by count descending (also default)
在你的情况下,你需要这样的东西:
GET /_all/_search?search_type=count&q=_type:invoice
{
"aggs": {
"by_index": {
"terms": {
"field": "_index",
"size": 0
}
}
}
}
正在尝试获取所有索引的计数。我在 URL 中使用 _all
。以下代码有效,但未返回所有索引的数据。
GET /_all/_search?search_type=count&q=_type:invoice
{
"aggs": {
"by_index": {
"terms": {
"field": "_index"
}
}
}
}
大多数索引在输出中被跳过。索引是否有限制或我的代码有问题?
是的,默认返回结果的限制是10个:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/_executing_aggregations.html.
To start with, this example groups all the accounts by state, and then returns the top 10 (default) states sorted by count descending (also default)
在你的情况下,你需要这样的东西:
GET /_all/_search?search_type=count&q=_type:invoice
{
"aggs": {
"by_index": {
"terms": {
"field": "_index",
"size": 0
}
}
}
}