Reputation: 1
I'm rather new to ElasticSearch and was wondering if there's a way to implement an auto-completion feature for key-phrases in documents.
Assuming I have documents like below: doc 1: "...Neural Network Project..." doc 2: "...Neutral Reaction of Chemical..."
and if the query is "neu" then I want it to return: "Neural" "Neutral" "Neural Network" "Neutral Reaction"
I have tried Phrase Suggester which only does spell-checking on the input phrase. I've also tried Completion Suggester which has 2 major shortcomings for the mentioned senario: 1- Completion Suggeter is based on the prefix of the query and documents, meaning if the target word-phrase is in the middle of the sentence, the document wouldn't be returned as a result. 2- It returns characters limited by "Max_input_length" parameter as the result, meaning the results won't be in a word-phrase form like "Phrase Suggester". P.S. I'm aware of the fact that I can add input/output parameters to Completion Suggester to fix these issues but the number of documents in my index are massive and possibly growing which makes this task very time-consuming and also inaccurate.
Now I was wondering, is there a workaround for this? Is there a different ES functionality I should be looking for or it just cannot be done by built-in ES functions?
Upvotes: 0
Views: 239
Reputation: 35
I think you're in the right ballpark of what Elastic recommends. Their official example setup uses Term Suggester instead of Phrase Suggester in case that gets you closer to your use case. (Their docs have various products as back-ends (e.g. AppSearch, Workplace Search, Elasticsearch) so linking the Elasticsearch tutorial.)
Alternatives towards the same end-goal from Elasticsearch: Completion Suggester (same doc ballpark you're talking), autocomplete analyzer (more info)
Alternative Elasticsearch examples from community: manual string check (same but only check as prefix, with fuzziness)
Upvotes: 0