我正在尝试使用以下命令使用 mongodb-river 在 elasticsearch 中索引 mongodb,但文档映射未生效。它仍然使用默认的分析器(标准)作为字段text
Mongodb-river 文档指定了索引的创建,但没有关于如何提供自定义映射的文档。这是我尝试过的。是否有任何其他文档可以在其中找到如何在使用 mongodb-river 时指定自定义分析器等。
curl -XPUT "localhost:9200/_river/autocompleteindex/_meta" -d '
{
"type": "mongodb",
"mongodb": {
"host": "rahulg-dc",
"port": "27017",
"db": "qna",
"collection": "autocomplete_questions"
},
"index": {
"name": "autocompleteindex",
"type": "autocomplete_questions",
"analysis" : {
"analyzer" : {
"str_search_analyzer" : {
"tokenizer" : "keyword",
"filter" : ["lowercase"]
},
"str_index_analyzer" : {
"tokenizer" : "keyword",
"filter" : ["lowercase", "ngram"]
}
},
"filter" : {
"ngram" : {
"type" : "ngram",
"min_gram" : 2,
"max_gram" : 20
}
}
}
},
"autocompleteindex": {
"_boost" : {
"name" : "po",
"null_value" : 1.0
},
"properties": {
"po": {
"type": "double"
},
"text": {
"type": "string",
"boost": 3.0,
"search_analyzer" : "str_search_analyzer",
"index_analyzer" : "str_index_analyzer"
}
}
}
}'
查询返回正确的结果是我按全字搜索但不匹配任何子字符串匹配。此外,升压因子也没有显示出它的效果。
我究竟做错了什么 ??