Elasticsearch:对组合聚合的结果进行排序

时间:2020-06-29 08:47:35

标签: elasticsearch nest

我正在使用复合词,术语和热门词汇的组合。我想根据文档的属性(嵌套字段属性)对结果(检索到的组)进行排序。 我读到有关存储桶排序的信息,但实际上不确定这是否是我的理想解决方案。

这是我的聚合查询部分:

"aggs": {
        "my_comp_agg": {
          "aggs": {
            "my_terms_agg": {
              "aggs": {
                "my_tophits_agg": {
                  "top_hits": {
                    "size": 1,
                    "sort": [
                      {
                        "TimeTicks": {
                          "order": "desc"
                        }
                      }
                    ]
                  }
                }
              },
              "terms": {
                "field": "my_property",
                "size": 10
              }
            }
          },
          "composite": {
            "after": {
              "my_comp_terms_agg": ""
            },
            "size": 10,
            "sources": [
              {
                "my_comp_terms_agg": {
                  "terms": {
                    "field": "my_property"
                  }
                }
              }
            ]
          }
        },
        "my_count_agg": {
          "cardinality": {
            "field": "my_property"
          }
        }
      }

有人可以帮我解决这个问题吗?

0 个答案:

没有答案