Keep Words Token Filteredit

A token filter of type keep that only keeps tokens with text contained in a predefined set of words. The set of words can be defined in the settings or loaded from a text file containing one word per line.

Optionsedit

keep_words

a list of words to keep

keep_words_path

a path to a words file

keep_words_case

a boolean indicating whether to lower case the words (defaults to false)

Settings exampleedit

PUT /keep_words_example
{
    "settings" : {
        "analysis" : {
            "analyzer" : {
                "example_1" : {
                    "tokenizer" : "standard",
                    "filter" : ["lowercase", "words_till_three"]
                },
                "example_2" : {
                    "tokenizer" : "standard",
                    "filter" : ["lowercase", "words_in_file"]
                }
            },
            "filter" : {
                "words_till_three" : {
                    "type" : "keep",
                    "keep_words" : [ "one", "two", "three"]
                },
                "words_in_file" : {
                    "type" : "keep",
                    "keep_words_path" : "analysis/example_word_list.txt"
                }
            }
        }
    }
}