【发布时间】:2021-08-31 10:02:59
【问题描述】:
在 Elasticsearch 中使用不同的 a 字段时如何获取元素计数?我想在不同的字段之一时获得索引的总元素。我可以使用这些代码进行搜索:
**POST myIndex/_search**
{
"size": 0,
"aggs": {
"myField": {
"terms": {
"field": "name’s of my field",
"size": 10000
}
}
}
.
.
.
}
但是,我想查询类似于:
**GET myIndex/_count**
{
"size": 0,
"aggs": {
"myField": {
"terms": {
"field": "name’s of my field",
"size": 10000
}
}
}
.
.
.
}
但返回错误:
**{
"error" : {
"root_cause" : [
{
"type" : "parsing_exception",
"reason" : "request does not support [size]",
"line" : 2,
"col" : 3
}
],
"type" : "parsing_exception",
"reason" : "request does not support [size]",
"line" : 2,
"col" : 3
},
"status" : 400
}**
所以我对这个问题的解决方案感兴趣。
【问题讨论】:
标签: elasticsearch count distinct