Autocomplete feature with edge ngrams

Hi there,

I'm trying to build an autocomplete feature and am trying to use an edge_ngram filter with a custom analyzer and a fuzzy search. A issue I'm having is that a query might (probably will) match multiple records, but I want an unique set of results. Does anyone have any idea of how to do this, or if there is a different approach that might work?

PS: I don't think I can use the completion suggester because I have to be able to autocomplete from the middle of works as well, no only prefix

You mean multiple individual documents may have the same suggestion text, and you can't dedup that at indexing time?

You could maybe use terms aggregation, but this could easily be way too costly for a suggester.

Lucene has an infix suggester (AnalyzingInfixSuggester) and it seems to work quite well (see e.g. http://jirasearch.mikemccandless.com for a running example), but it hasn't yet been exposed in ES. There's an issue to do so: https://github.com/elastic/elasticsearch/issues/17029 but it hasn't gotten very far...

Mike McCandless

I ended up solving it by creating a new index where the records are already unique, but thanks.

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