elasticsearch - update_by_query用于多字段

标签 elasticsearch elasticsearch-2.0

我在索引中添加了现有字段(multi field)的新raw(response)。并且由于新的多字段raw将没有数据。我试图从源添加数据,如下所示。

POST /y_metrics/response/_update_by_query
{
  "script":{
    "inline":  "ctx._source.response['raw'] = ctx._source.response;"
  },
  "query": {
        "match_all": {}
    }
}

失败:
 "type": "missing_property_exception",
 "reason": "No such property: raw for class: java.lang.String"

第二次尝试:
POST /y_metrics/response/_update_by_query
{
  "script":{
    "inline":  "ctx._source['response.raw'] = ctx._source.response;"
  },
  "query": {
        "match_all": {}
    }
}

失败:
    "type": "mapper_parsing_exception",
    "reason": "Field name [response.raw] cannot contain '.'"

显然,问题似乎是由于“。”引起的。但是在这种情况下,还有其他人可以访问multi field吗?我了解了de_dot过滤器是否对我有帮助?

最佳答案

如果您将字段添加到现有字段(因此是多字段),则无需使用脚本,只需重新索引即可,其余的将由Elasticsearch处理。您可以通过查询调用删除更新的script部分。

关于elasticsearch - update_by_query用于多字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45884597/

相关文章:

ruby-on-rails-4 - 在任何列中搜索单词的任何部分

javascript - 如何在不使用 require 的情况下让 elasticsearch.js 工作?

regex - Kibana : Cannot query with regex having space

elasticsearch - 无法运行Elasticsearch嵌套聚合查询

elasticsearch - Elasticsearch :聚合随机顺序?

json - ElasticSearch-如何限制每个组合查询的大小?

python-2.7 - 升级Elasticsearch DSL

Elasticsearch:获取当前正在运行的快照操作

ruby-on-rails - Elasticsearch为法语或英语字段配置词干

elasticsearch - 根映射定义的参数不受支持