【发布时间】:2020-07-07 19:49:43
【问题描述】:
我刚刚开始使用 Elasticsearch,并且正在为我的 .Net 应用程序使用 NEST API。我有一个索引和一些插入的记录。我现在正在尝试获取文档字段值的不同列表。我有这个在邮递员工作。 我不知道如何将 JSON 聚合体移植到 NEST 调用中。这是我尝试移植到 NEST C# API 的调用:
{
"size": 0,
"aggs": {
"hosts": {
"terms": {
"field": "host"
}
}
}
这是我的下一个问题的结果。 我将如何解析或将 POCO 分配给结果?我只对在这种情况下为“主机”的字段值的不同列表感兴趣。我真的只是想要一个可枚举的字符串。我现在不在乎计数。
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 3,
"relation": "eq"
},
"max_score": null,
"hits": []
},
"aggregations": {
"hosts": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "hoyt",
"doc_count": 3
}
]
}
}
}
【问题讨论】:
标签: elasticsearch nest elasticsearch-aggregation