【发布时间】:2019-08-07 03:26:40
【问题描述】:
如何将此弹性搜索查询转换为嵌套查询。 查询给出了 Bellow 。 GET winlogbeat-6.6.0*/_search?size=0
{
"query": {
"match_all": {}
},
"aggs": {
"success ": {
"filter": {
"term": {
"event_id": 4624
}
}
},
"failed": {
"filter": {
"term": {
"event_id": 4625
}
}
}
}
}
在 Kibana 中想要的输出如下
{
"took" : 13120,
"timed_out" : false,
"_shards" : {
"total" : 37,
"successful" : 37,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 299924794,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"failed" : {
"doc_count" : 351643
},
"success " : {
"doc_count" : 40375274
}
}
}
这是我的代码,我需要将其转换为 NEST 以获得所需的结果。 谢谢
【问题讨论】:
-
你能分享一下你到目前为止所尝试的吗?
-
var queryWinlogbeat_6_6_0 = _elasticClient.Search
(q => q .Index("winlogbeat-6.6.0*") .Size(0) .Aggregations(a => a .Filter("成功”, fa => fa .Filter(f => f.Term(o => o.event_id, 4624)) ) ) );此代码为我返回“成功”存储桶的正确记录,但如何对“失败”存储桶进行另一个过滤器 -
@NisarAhmad 您可以编辑问题以添加其他详细信息,例如您到目前为止所尝试的内容。这也可以让你格式化它
标签: elasticsearch asp.net-core nest