[英]update_by_query for multi field
I have added a new multi field
( raw
) of an existing field ( response
) in the index. 我在索引中添加了现有字段(
response
)的新的multi field
( raw
)。 And since the new multi field raw
will have no data. 而且由于新的多字段
raw
数据将没有数据。 I tried to add data from source as below. 我试图从源添加数据,如下所示。
POST /y_metrics/response/_update_by_query
{
"script":{
"inline": "ctx._source.response['raw'] = ctx._source.response;"
},
"query": {
"match_all": {}
}
}
fails : 失败:
"type": "missing_property_exception",
"reason": "No such property: raw for class: java.lang.String"
2nd try : 第二次尝试:
POST /y_metrics/response/_update_by_query
{
"script":{
"inline": "ctx._source['response.raw'] = ctx._source.response;"
},
"query": {
"match_all": {}
}
}
fails: 失败:
"type": "mapper_parsing_exception",
"reason": "Field name [response.raw] cannot contain '.'"
Apparently, the problem seems to be because of ".". 显然,问题似乎是由于“。”引起的。 But how else one would access
multi field
in this case ? 但是在这种情况下,又将如何访问
multi field
呢? I read about de_dot
filter does it help in my case ? 我了解到
de_dot
过滤器对我有帮助吗?
if you add a field to an existing field (thus a multi field), there is no need to use a script, just reindex and Elasticsearch will handle the rest. 如果将字段添加到现有字段(因此是多字段),则无需使用脚本,只需重新索引即可,其余的将由Elasticsearch处理。 You can just drop the
script
part of your update by query call. 您可以通过查询调用删除更新的
script
部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.