Min shingle size

Hello,

I am currently researching how to optimize my queries using n-grams. I decided to use Elasticsearch to generate the n-grams, so I set up a trial account. I managed to get n-grams from a sample string, but I got the following error message:

Min shingle size must be >= 2

I am afraid I need shingles with size 1, so I want to ask whether that is possible. Do you think it is appropriate to use Elasticsearch to get n-grams as shingles?

Thank you.

I'm somewhat confused, are you attempting to use n-grams with size one, or shingles with size one?

I meant shingles, sorry.

No problem :slight_smile:

You can configure output_unigrams: true if you want the shingle filter to always emit the unigram shingle token. Or you can configure output_unigrams_if_no_shingles: true if you want the unigram to be emitted only when there aren't multi-gram shingles.

There's more detail at the docs page: https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-shingle-tokenfilter.html

Thank you.

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