Better way to implement "contain with"

Currently we are using wildcard query start and end with * to implement the "contains with" function, however it seems the performance is really bad, and we find that ES have documented this on https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-wildcard-query.html

So I'm wondering whether there is a better way to replace the wildcard query?

Try using n-grams instead of wildcards:
https://www.elastic.co/guide/en/elasticsearch/guide/current/_ngrams_for_partial_matching.html

N-grams required increased storage and could suffer from precision issue if
not tuned.

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