我正在使用 7.7 版的 ElasticSearch、LogStash 和 Kibana 并尝试更新字段的索引映射会导致 2 个错误之一:
mapper_parsing_exception: analyzer on field [title] must be set when search_analyzer is set
illegal_argument_exception: Mapper for [title] conflicts with existing mapping:\n[mapper [title] has different [analyzer]]
这是我正在尝试的操作。如果我删除"analyzer": "standard"
,我会收到第一个错误。如果我把它留在里面,我会得到第二个错误。
PUT /my_index/_mapping
{
"properties": {
"title": {
"type": "text",
"analyzer": "standard",
"search_analyzer": "synonyms"
}
}
}
但是,当我使用 获取映射时GET /my_index/_mapping
,我没有看到任何定义的分析器:
"title" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
额外信息
这是我设置“同义词”搜索分析器的方法,但我认为这无关紧要:
POST /my_index/_close
PUT /my_index/_settings
{
"index": {
"analysis": {
"analyzer": {
"synonyms": {
"tokenizer": "whitespace",
"filter": [
"lowercase",
"the_synonyms"
]
}
},
"filter": {
"the_synonyms": {
"type": "synonym",
"synonyms_path": "the_synonyms.txt",
"updateable": true
}
}
}
}
}
POST /my_index/_open