这是我的查询:
{
"settings": {
"analysis": {
"analyzer": {
"folding": {
"tokenizer": "whitespace",
"filter": [ "lowercase", "asciifolding" ]
}
},
"normalizer": {
"lowerasciinormalizer": {
"type": "custom",
"filter": [ "lowercase", "asciifolding" ]
}
}
}
},
"mappings": {
"entity": {
"properties": {
"Description": {
"type": "text",
"analyzer": "whitespace",
"normalizer": "lowerasciinormalizer"
},
"Name": {
"type": "text",
"analyzer": "whitespace",
"normalizer": "lowerasciinormalizer"
}
}
}
}
}
entity
是索引中的一种。
我收到错误消息:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [Description] has unsupported parameters: [normalizer : lowerasciinormalizer]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [entity]: Mapping definition for [Description] has unsupported parameters: [normalizer : lowerasciinormalizer]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [Description] has unsupported parameters: [normalizer : lowerasciinormalizer]"
}
},
"status": 400
}
我该如何解决?
答案 0 :(得分:1)
Normalizer保证它产生单个令牌,并且只能应用于关键字类型字段,而不能应用于文本类型字段。您可以做的是将fields
添加到属性为keyword
类型的属性中,并对其应用令牌化器。
这是修改映射的方法:
{
"settings": {
"analysis": {
"analyzer": {
"folding": {
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding"
]
}
},
"normalizer": {
"lowerasciinormalizer": {
"type": "custom",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
},
"mappings": {
"entity": {
"properties": {
"Description": {
"type": "text",
"analyzer": "whitespace",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowerasciinormalizer"
}
}
},
"Name": {
"type": "text",
"analyzer": "whitespace",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowerasciinormalizer"
}
}
}
}
}
}
}