Strategy for grouping suggest completions


(Craig Ching) #1

I am trying to group completion suggestions using the "Completion Suggester" as described here:

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-completion.html

And I notice that along with that is the "Context Suggester" described here:

https://www.elastic.co/guide/en/elasticsearch/reference/current/suggester-context.html

And for the most part the context suggester seems pretty decent for grouping except that the context has to be known a priori, i.e. before I run the suggest search. In my case, the context is on a field that is specific to my users, not something I can know a priori. NBD I thought, I'll just run an aggregation first to get the counts for each possible context value for the field, then run the suggest with context information found from the aggregation ...

except that the completion suggester isn't like a search, there doesn't appear to be a way to run the aggregation with a FQ or other query against the type: "completion" field because it has its own endpoint (_suggest).

So, back to the drawing board on suggest. Does anyone have any advice for the best way to handle grouping suggestions based on an unknown value in a known field?


(system) #2