我正在尝试创建这个自定义分析器,但由于某种原因我得到了Analyzer [] not found for field []
错误......我环顾四周并尝试了不同的实现,我认为我有正确的语法......这里是:
settings :number_of_shards => 5,
:number_of_replicas => 2,
:analysis => {
:analyzer => {
:ticker_analyzer => {
"type" => 'custom',
"tokenizer" => 'ticker_pattern',
"filter" => [ 'word_delimiter_filter', 'standard' ]
}
},
:filter => {
:word_delimiter_filter => {
"type" => 'word_delimiter',
"preserve_original" => true
}
},
:tokenizer => {
:ticker_pattern => {
"type" => 'pattern',
"pattern" => '\w+'
}
}
} do
mapping do
# ... some more indexes that work fine, with regular analyzers
indexes :company_ticker, type: 'string', boost: 5.0, analyzer: 'ticker_analyzer', as: 'index_company_ticker'
end
end
所以我得到了错误Analyzer [ticker_analyzer] not found for field [company_ticker]
。
任何想法为什么?
此外,我还看到了一些不需要将块传递给settings
选项的示例。我会在之后关闭settings
并定义mapping
它会起作用吗?(我在其他人发布代码片段时看到过这个......)
谢谢!
-弗拉德