我在Elasticsearch中有一个名为 memberInfoId 的字段,其值在每个文档中都是唯一的。我的Elasticsearch中有成千上万的文档,因此,如果必须提取所有 memberInfoId 的值,则术语聚合似乎非常繁琐。有其他选择吗?
答案 0 :(得分:0)
由于字段值是唯一的,因此您可以获取所有文档的memberinfoId
GET index/_search
{
"_source": "memberinfoId"
}
结果
"hits" : [
{
"_index" : "index",
"_type" : "_doc",
"_id" : "9wm5jWsBsaS8x8rcaQum",
"_score" : 1.0,
"_source" : {
"memberinfoId" : 1
}
},
{
"_index" : "index",
"_type" : "_doc",
"_id" : "-Am5jWsBsaS8x8rcjwv5",
"_score" : 1.0,
"_source" : {
"memberinfoId" : 1
}
}
]
}
您可以使用“ from”和“ size”对以上数据进行分页。