Substring search

Does Elasticsearch support (or what are the options for) substring
search?

Example "ball" or "bal" in basketball?

Thanks.

Hi Anonymous!

Am Sonntag, 25. März 2012 22:36:09 UTC+2 schrieb be.the.water:

Does Elasticsearch support (or what are the options for) substring
search?

Example "ball" or "bal" in basketball?

You have two options:

  1. Use ngrams through the ngram token filter:
    Elasticsearch Platform — Find real-time answers at scale | Elastic.
    See Wikipedia for details: n-gram - Wikipedia
  2. Use the compound token filter
    Elasticsearch Platform — Find real-time answers at scale | Elastic
    (which I have contributed to Lucene btw.)

The ngrams are useful if you cannot provide a dictionary because you don't
know what type of documents you have to index. The downside is that they
use a lot of space in your indices. So you need to be careful here.

CU

Thomas