您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何从Filter Aggregation返回的文档集中将当前聚合上下文缩小到特定范围?

如何从Filter Aggregation返回的文档集中将当前聚合上下文缩小到特定范围?

尝试以下聚合:

{
  "aggs": {
    "continents": {
      "nested": {
        "path": "continents"
      },
      "aggs": {
        "asia_continent": {
          "filter": {
            "query": {
              "match": {
                "continents.name": "asia"
              }
            }
          },
          "aggs": {
            "countries": {
              "nested": {
                "path": "continents.countries"
              },
              "aggs": {
                "india_country": {
                  "filter": {
                    "query": {
                      "match": {
                        "continents.countries.name": "india"
                      }
                    }
                  },
                  "aggs": {
                    "states": {
                      "nested": {
                        "path": "continents.countries.states"
                      },
                      "aggs": {
                        "count": {
                          "value_count": {
                            "field": "continents.countries.states.wins"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
其他 2022/1/1 18:15:45 有561人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶