As mentioned in a ramseykhalaf comment, a pebble filter will produce tokens with a length of "n" words.
"settings" : { "analysis" : { "filter" : { "shingle":{ "type":"shingle", "max_shingle_size":5, "min_shingle_size":2, "output_unigrams":"true" }, "filter_stop":{ "type":"stop", "enable_position_increments":"false" } }, "analyzer" : { "shingle_analyzer" : { "type" : "custom", "tokenizer" : "whitespace", "filter" : ["standard," "lowercase", "shingle", "filter_stop"] } } } }, "mappings" : { "type" : { "properties" : { "letters" : { "type" : "string", "analyzer" : "shingle_analyzer" } } } }
See the blog post for more details.
source share