내가 지금 일이 알아 내려고 노력 C#을 NEST 몇 가지 도움이 필요합니까 :탄성 검색 NEST : 멀티 레벨 깊은 Aggregrations 읽기
상황 : 나는 여러 종류의 문서를 다시 제공하는 쿼리를, 나는 해당 doc_count를 사용하여 모든 유형을 나열하는 집계를 만들었습니다. 즉석 티켓의 경우이 티켓에는 299 건의 티켓이 있습니다. (https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/nested-aggregation-usage.html#_handling_responses_25)
var tags = response.Aggs.Nested("tags");
var tagNames = tags.Terms("tag_names");
이것은 한 단계 깊은 aggegrations 작동하지만 내 어떤 수준 깊은 있습니다
지금 나는 다음을 수행하는 데 필요한 설명서에 따라, 데이터에 도착해야합니다.
이것은 Aggs 절입니다 :
이"aggs": {
"filtered_types": {
"terms": {
"field": "_type"
}
},
"all_types": {
"global": {},
"aggs": {
"all_result_types": {
"filter": {
"bool": {
"must": [
{
"query_string": {
"default_field": "_all",
"query": "\"test\""
}
}
]
}
},
"aggs": {
"result_types": {
"terms": {
"field": "_type"
}
}
}
}
}
}
}
나의 응답은 다음이 될 것입니다 :
"aggregations": {
"filtered_types": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "ticket",
"doc_count": 105
},
{
"key": "iteration",
"doc_count": 10
}
]
},
"all_types": {
"doc_count": 2516,
"all_result_types": {
"doc_count": 193,
"result_types": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "ticket",
"doc_count": 105
},
{
"key": "comment",
"doc_count": 67
},
{
"key": "iteration",
"doc_count": 10
},
{
"key": "profile",
"doc_count": 6
},
{
"key": "project",
"doc_count": 3
},
{
"key": "company",
"doc_count": 1
},
{
"key": "sla",
"doc_count": 1
}
]
}
}
}
}
응답이 내가 필요 정확히이지만, NEST와 내가 얻을 수없는 것, 올바른 내 데이터가있는 "result_types"
누구든지 데이터를 얻으려면 해결책을 찾길 바랍니다.
고맙습니다. 평생 답변을드립니다. .Filter()에 대해 몰랐습니다. –
걱정하지 마시고 도와 드리겠습니다. :) –