也许我错过了一些简单的事情,但仍然无法弄清楚以下事情:
从 ES 6.x 开始_all
字段已弃用,建议使用copy_to
操作说明 (https://www.elastic.co/guide/en/elasticsearch/reference/current/copy-to.html https://www.elastic.co/guide/en/elasticsearch/reference/current/copy-to.html).
但是,我的印象是您需要明确指定要复制到自定义的字段_all
场地。但是如果我使用动态映射,我事先不知道这些字段,因此无法使用copy_to
?
我可以通过任何方式告诉 ES 将所有遇到的字段复制到自定义字段_all
字段以便我可以搜索所有字段?
提前致谢!
你可以使用动态模板 https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html。基本上创建一个索引,添加自定义catch_all
字段,然后为所有字符串字段指定该特定属性。 (以前没有这样做过,但我相信这是现在唯一的方法。自从该领域catch_all
当您放置动态模板时,它已经存在,它将与catch_all
- 意思是catch_all
不会复制到自身,但请自行检查以确保)。
PUT my_index
{
"mappings": {
"_doc": {
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "text",
"copy_to": "catch_all"
}
}
}
]
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)