gpt4 book ai didi

lucene - ElasticSearch:配置定制分析器实现

转载 作者:行者123 更新时间:2023-12-02 23:06:11 24 4
gpt4 key购买 nike

目前,我正在评估是否以及如何将基于lucene的传统分析仪组件移至 flex 搜索(0.19.18)。由于遗留代码是基于Lucene的,因此我将分析仪包装在es插件中。分析仪的配置类似于以下几行:

index.analysis.analyzer.myAnalyzer.type : myAnalyzer
index.analysis.analyzer.default.type: myAnalyzer
index.analysis.analyzer.default_index.type: myAnalyzer
index.analysis.analyzer.default_search.type: myAnalyzer

到现在为止还挺好。
curl -XGET 'localhost:9200/_analyze' -d 'Some text'

将返回一个包含正确标记化文本的对象,但是
curl -XGET 'localhost:9200/<name-of-my-index>/_analyze' -d 'Some text'

将返回一个文本,该文本根本没有标记。显然,不是使用myAnalyzer而是应用了小写过滤器。索引中的对象均未正确分析。

索引映射如下所示(head-plugin的输出):
mappings: {
item: {
analyzer: myAnalyzer
properties: {
id: {
type: string
}
itemnumber: {
type: string
}
articletext: {
analyzer: myAnalyzer
type: string
}
sortvalue: {
type: string
}
salesstatus: {
format: dateOptionalTime
type: date
}
}
}
}

由于我是ES的新手,所以我不知道这种行为的真正原因是什么。有想法的人吗?

最佳答案

这就是我在Elasticsearch中设置自定义默认分析器的方式。

index:
analysis:
analyzer:
default:
filter: [lowercase]
tokenizer: whitespace
type: custom

奇迹般有效。

关于lucene - ElasticSearch:配置定制分析器实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11505789/

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