Elasticsearch - 动态字段模板映射
问题描述:
例如,我想为书籍和文件进行映射。这些书和文件具有共同的标题字段,但之后它们是不同的字段。所以,我制作了动态模板(使这种映射的主要原因是让一些字符串字段设置为关键字,而不是文本)。Elasticsearch - 动态字段模板映射
PUT my_index
{
"mappings" : {
"my_type" : {
"properties" : {
"title" : {
"type" : "keyword"
},
"props" : {
"dynamic" : true,
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
]
}
}
}
}
}
我是这样做的,但错误与此相伴。
“原因”: “失败映射[my_type]解析:无类型 字段[道具]中指定的”,
的这个任何想法?
答
动态模板类型的根看the link
你应该有水木清华这样
{
"mappings": {
"my_type": {
"properties": {
"title": {
"type": "keyword"
}
},
"dynamic_templates": [
{
"strings": {
"path_match": "props.*",
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
]
}
}
}
它在场内效应“道具”? –
@ J.Done您需要使用“path_match”:“道具。*”, –
@ J.Done请参阅更新 –