原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/analysis-predicatefilter-tokenfilter.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/analysis-predicatefilter-tokenfilter.html
本地英文版地址: ../en/analysis-predicatefilter-tokenfilter.html
重要: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 当前版本文档。
Predicate script token filteredit
The predicate_token_filter token filter takes a predicate script, and removes tokens that do not match the predicate.
Optionsedit
script |
a predicate script that determines whether or not the current token will be emitted. Note that only inline scripts are supported. |
Settings exampleedit
You can set it up like:
PUT /condition_example { "settings" : { "analysis" : { "analyzer" : { "my_analyzer" : { "tokenizer" : "standard", "filter" : [ "my_script_filter" ] } }, "filter" : { "my_script_filter" : { "type" : "predicate_token_filter", "script" : { "source" : "token.getTerm().length() > 5" } } } } } }
And test it like:
POST /condition_example/_analyze { "analyzer" : "my_analyzer", "text" : "What Flapdoodle" }
And it’d respond: