我在索引中添加了现有字段(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/