Completion suggester for search terms instead of documents

When using the Completion Suggester, the results you get are regular documents. I get that :slight_smile:

However, we'd like to receive search phrase suggestions instead of direct results (the documents). To achieve this we thought that we could store several corresponding "search phrases" to the documents, and provide this as the "suggest" field when indexing.

In general this works, however the Suggester returns now all documents which contains these matches search phrases, which causes duplicate phrases.

For instance when having 2 documents:

  • Document A is a blue "BMW X3", which has "blue car" attached as "suggest" phrase.
  • Document B is a blue "Volvo V60", which also has "blue car" attached as "suggest" phrase.

When searching for "blue", the Suggester now returns both documents, and in fact this is a duplicate result we don't want.

Is the above setup the way to go, and how could we filter out these duplicates? Or do we need a different approach?

We added a new option called skip_duplicates for the completion suggester:

This option when set is able to remove the duplicated documents (document matching with a suggestion already returned in a previous doc). It will be available in es 6.1.

1 Like

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