Skip to content

Instantly share code, notes, and snippets.

@duydo
Created May 24, 2012 10:12
Show Gist options
  • Save duydo/2780649 to your computer and use it in GitHub Desktop.
Save duydo/2780649 to your computer and use it in GitHub Desktop.
ElasticSearch - substring search
You have two options:
Use ngrams through the ngram token filter: http://www.elasticsearch.org/guide/reference/index-modules/analysis/ngram-tokenfilter.html. See Wikipedia for details: http://en.wikipedia.org/wiki/N-gram
Use the compound token filter http://www.elasticsearch.org/guide/reference/index-modules/analysis/compound-word-tokenfilter.html (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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment