小编pan*_*000的帖子

按最高命中分数的弹性搜索聚合顺序

我想通过top_hit的doc.score订购存储桶.我目前的实施情况如下.

  group_by_iid: {
    terms: {
      field: 'iid',
      order: { max_score: 'desc' },
      size: 0
    },
    aggs: {
      max_score: { max: { script: 'doc.score' } },
      top_hit: {
        top_hits: {
          sort: [{ source_priority: { order: 'desc' } }],
          size: 1
        }
      }
    }
  }
Run Code Online (Sandbox Code Playgroud)

这是错误的,因为存储桶按其最高分排序,而不是按其最高source_priority文档的分数排序.有没有办法解决这个问题?

aggregation elasticsearch

13
推荐指数
1
解决办法
1万
查看次数

标签 统计

aggregation ×1

elasticsearch ×1