如何在NEST词项汇总查询c#中获得与kibana相同的弹性搜索结果>> [

问题描述 投票:0回答:1
kibana dev-tool

GET gltrans/_search?size=0 { "aggs": { "code": { "terms": { "field": "code.keyword" }, "aggs": { "total": { "sum": { "field": "tot" } } } } } }

返回

"buckets" : [ { "key" : "0220", "doc_count" : 30182, "total" : { "value" : 169779.83551708516 } }, { "key" : "3000", "doc_count" : 20360, "total" : { "value" : -477618.27972452715 } },................

巢状查询

var result = _connectionToEs.EsClient().Search<gltrans>(s => s.Size(0) .Aggregations(a => a .Terms("code", st => st .Field(o => o.code.Suffix("keyword")) .Size(10) .Aggregations(aa => aa .Sum("total", m => m .Field(o => o.tot))))));

没有“钥匙”的返回如何获得钥匙?

"Items": [ { "tot": { "Value": 169779.83551708516, "ValueAsString": null, "Meta": null } }, { "tot": { "Value": -477618.27972452715, "ValueAsString": null, "Meta": null } },

kibana开发工具GET gltrans / _search?size = 0 {{“ ggs”:{“ code”:{“ terms”:{“ field”:“ code.keyword”},“ aggs”:{“ total”: {“ sum”:{“ ...
c# asp.net-mvc elasticsearch nest
1个回答
1
投票
您可以从响应中获取密钥
© www.soinside.com 2019 - 2024. All rights reserved.