如何使用elasticsearch在聚合器中按日期文档排序

时间:2014-09-17 21:51:47

标签: elasticsearch aggregator

我有这些聚合器来重复删除文档:

   $searchParams['body'] = [
        'aggs' => [
            'dedup' => [
                'terms' => [
                    'field' => 'source',
                    'size' => 50,
                    'order' => [
                        'max_hits' => "desc"
                    ]
                ],
                'aggs' => [
                    'dedup_hits' => [
                        'top_hits' => [
                            'size' => 1
                        ]
                    ],
                    'max_hits' => [
                        'max' => [
                            "script" => "doc.score"
                        ]
                    ]
                ]
            ]
        ]
    ];

此查询按文档分数排序。但是,我想按_timestamp字段排序。可能吗?我用Date Histogram聚合器测试了。但没有成功。

0 个答案:

没有答案