Limit ngram based on the token

Is it possible to limit ngram to generate ngrams only for the first two or three characters. more like a traveling edge ngram.
The min and max ngram would not be the same values as I want it to behave like edge ngram.

The reason I am doing this is I would to have substring search like say "234567" and 123456789 should appear.

note: in the real world the tokens are alphanumeric and substring search is on keyword

ex:

123456789

I would like edge ngrams for 123456789
23456789, 3456789.

limiting ngram to first 3 characters.

current ngram config

"ngram_filter": {
"type": "nGram",
"min_gram": 2,
"max_gram": 500
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.