【问题标题】:elastic search top_hits aggregation with lucene expression具有 lucene 表达式的弹性搜索 top_hits 聚合
【发布时间】:2015-07-11 07:20:54
【问题描述】:

我想做一个字段折叠顶部点击聚合,完全按照此处记录:

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html#_field_collapse_example

尤其是这一段是个问题:

"top_hit": {
    "max": {
        "script": "_score"
    }
}

因为生产环境配置有:

script.disable_dynamic: sandbox

这意味着我不能使用 groovy 脚本,而不会出现以下错误:

nested: ScriptException[dynamic scripting for [groovy] disabled];

如果我像这样更改查询:

"top_hit": {
    "max": {
        "lang": "expression",
        "script": "_score"
    }
}

我收到不同类型的错误:

nested: IllegalStateException[Expressions referencing the score can only be used for sorting];

弹性搜索版本为 1.5.2。有没有办法做我想做的事(使用 lucene 表达式)?

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    经过一番谷歌搜索后,我找到了答案。这是一个已修复的已知问题。

    https://github.com/elastic/elasticsearch/issues/10091

    目前还不清楚它是在哪个版本中修复的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-06
      • 2017-03-10
      • 2019-11-08
      相关资源
      最近更新 更多