gpt4 book ai didi

java - 设置 search_analyzer 时,必须设置字段 [filename] 上的分析器。 Elasticsearch 错误

转载 作者:行者123 更新时间:2023-12-02 02:05:57 25 4
gpt4 key购买 nike

在为我的elasticsearch index_analyzer设置映射时收到以下错误消息

请查找下面的错误消息

{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "analyzer on field [filename] must be set when search_analyzer is set"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [doc]: analyzer on field [filename] must be set when search_analyzer is set",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "analyzer on field [filename] must be set when search_analyzer is set"
}
},
"status": 400
}

请查找我尝试过的映射详细信息

PUT /documents_test8
{
"settings" : {
"analysis" : {
"analyzer" : {
"filename_search" : {
"tokenizer" : "filename",
"filter" : ["lowercase"]
},
"filename_index" : {
"tokenizer" : "filename",
"filter" : ["lowercase","edge_ngram"]
}
},
"tokenizer" : {
"filename" : {
"pattern" : "[^\\p{L}\\d]+",
"type" : "pattern"
}
},
"filter" : {
"edge_ngram" : {
"side" : "front",
"max_gram" : 20,
"min_gram" : 1,
"type" : "edgeNGram"
}
}
}
},
"mappings" : {
"doc" : {
"properties" : {
"filename" : {
"type" : "text",
"search_analyzer" : "filename_search",
"index_analyzer" : "filename_index"
}
}
}
}
}

最佳答案

index_analyzer 属性不再存在,您需要使用 analyzer 代替

"mappings" : {
"doc" : {
"properties" : {
"filename" : {
"type" : "text",
"search_analyzer" : "filename_search",
"analyzer" : "filename_index" <-- change this
}
}
}
}

关于java - 设置 search_analyzer 时,必须设置字段 [filename] 上的分析器。 Elasticsearch 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50800306/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com