在我的elasticsearch.yml
文件中,我试图实现一些映射,其中一个属于一个类型的字段使用不同的分析器索引到其余的映射。Elasticsearch:构建Java客户端的映射
目前YAML文件的结构如下:
index:
bookshelf:
types:
book:
mappings:
title: {analyzer: customAnalyzer}
analysis:
analyzer:
# set standard analyzer with no stop words as the default
default:
type: standard
stopwords: _none_
# set custom analyser to provide relative search results
customAnalyzer:
type: custom
tokenizer: nGramTokenizer
filter: [lowercase,stopWordsFilter,asciifolding]
tokenizer:
nGramTokenizer:
type: nGram
min_gram: 1
max_gram: 2
filter:
nGramFilter:
type: nGram
min_gram: 1
max_gram: 2
stopWordsFilter:
type: stop
stopwords: _none_
这并不适用于自定义分析的标题字段,所以我希望有人也许能够指出我朝着正确的方向将定制分析仪到个别领域?
你知道为什么你的customAnalyzer没有被应用到标题字段吗?我无法从被接受的答案中感知 –
@BrianWebster不,我无法使其工作。我把它列入积压,并有意回到它。如果您成功实施自定义分析仪,请将您的解决方案添加到此问题中。谢谢 –
会做。我在这个过程中还是新手。但是,我想知道它是否有可能被应用,而且很难发现?例如,我不相信ES有办法查看令牌(应用分析器的结果)。你能列出你正在使用的测试用例吗? –