我正在使用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
最佳答案
以下作品。不确定以这种方式进行操作会有任何影响。我不这么认为,但是除了指出standard
分析器是默认分析器的文档之外,我也找不到关于它的任何文档。我基本上是通过猜测找到答案的。
PUT /my_index/_mapping
{
"properties": {
"title": {
"type": "text",
"analyzer": "default",
"search_analyzer": "synonyms"
}
}
}
关于elasticsearch - 如何更新ElasticSearch search_analyzer映射而在分析器上没有冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62307234/