Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Search-as-you-type datatype and Edge NGram Tokenizer?

Can't understand the difference between setting a Search-as-you-type datatype to a field, setting an Edge NGram Tokenizer in analyzer, and adding an index_prefixes parameter. It seems to me that they do the same job after all.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-as-you-type.html https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-edgengram-tokenizer.html https://www.elastic.co/guide/en/elasticsearch/reference/current/index-prefixes.html

like image 959
Anton Avatar asked Sep 02 '25 14:09

Anton


1 Answers

edge_ngram is a tokenizer, which means it kicks in at indexing time to tokenize your input data. There is also a edge_ngram token filter. Both are similar but work at different levels.

search_as_you_type is a field type which contains a few sub-fields, one of which is called _index_prefix and which leverages the edge_ngram tokenizer.

So basically, what you see in the edge_ngram tokenizer documentation has actually been leveraged when they decided to add the new search_as_you_type field type.

like image 154
Rafiqul Islam Avatar answered Sep 05 '25 14:09

Rafiqul Islam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!