IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Predicate script token filter
editPredicate script token filter
editThe predicate_token_filter token filter takes a predicate script, and removes tokens that do not match the predicate.
Options
edit
script |
a predicate script that determines whether or not the current token will be emitted. Note that only inline scripts are supported. |
Settings example
editYou 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: