我无法让Elasticsearch在诸如15 pound chocolate cake
的短语上生成适当的令牌。表演和对现场fielddata_field
查询时会产生沿结果的东西:Elasticsearch不生成数字令牌
pou poun pound cho choc choco chocol chocola chocolat chocolate cak cake
我看不出在那里所有的数字。我尝试过几种不同的分析器选项组合,但无济于事。下面是我的映射:
{ "settings" : { "index" : { "analysis": { "filter": { "nGram_filter": { "type": "edge_ngram", "min_gram": 3, "max_gram": 20 }, "my_word": { "type":"word_delimiter", "preserve_original": "true" } }, "analyzer": { "nGram_analyzer": { "type": "custom", "tokenizer": "standard", "filter": [ "standard", "lowercase", "asciifolding", "my_word", "nGram_filter" ] }, "whitespace_analyzer": { "type": "custom", "tokenizer": "whitespace", "filter": [ "lowercase", "asciifolding" ] } } }} }, "mappings": { "categories": { "properties": { "id": {"type": "text"}, "sort": {"type": "long"}, "search_term":{"type":"text","analyzer": "nGram_analyzer","search_analyzer": "whitespace_analyzer", "fielddata":true} } } } }
我已经试过了nGram
过滤器,如:
"nGram_filter": { "type": "edge_ngram", "min_gram": 3, "max_gram": 20, "token_chars": [ "letter", "digit", "punctuation", "symbol" ] }
还设置"generate_number_parts": "true"
在word_delimiter
"generate_word_parts": true
没有帮助。
编辑 我把它通过改变min_gram
规模至2个工作,但我希望能保持在3。我想知道是否有维持3克的大小,但也保持数的一种方式是什么?
是否有替代方案可以完成我想要的功能? – Yamaha32088
不将min_gram大小更改为2的具体原因? – Rahul