Elasticsearch排序聚合过滤器

时间:2018-04-09 09:59:23

标签: elasticsearch elasticsearch-aggregation

有没有办法对过滤器聚合进行排序?

GET item_*/_search
{
    "size": 0,
    "query": {
        "bool": {
            "filter": [
                {
                    "terms": {
                        "page_id": [
                            1,
                            652, ...
                        ]
                    }
                }
            ]
        }
    },
    "aggs": {
        "group1": {
            "filter": {
                "terms": {
                    "page_id": [
                        1,
                        652,...
                    ]
                }
            },
            "aggs": {
                "sum_items_likes": {
                    "sum": {
                        "field": "reactions.likes"
                    }
                }, ...
            }
        },
        "group2": ...
    }
}

我想按" aggregations.groupX.sum_items_likes"

排序

我借此机会询问在汇总之前是否值得预先过滤 page_id

感谢您的帮助

0 个答案:

没有答案