How to combine completion, suggestion and match phrase across multiple text fields?

Hi there, as the title suggests (no pun intended!), i'm trying to combine a few things in a single Elasticsearch query.

Here's a google screenshot to show what i'm trying to do:

So when we start typing "can", it lists word like canadian, canada, etc. This is auto complete. However it lists additional words also like tire, post, post tracking, coronavirus etc. This is auto suggest. It searches for most relevant word in all fields. If we type "canxda" it should also show results. This is fuzziness. You'll note it's only prefix-based. I don't need to match the middle of a phrase.

Now, no idea if my terminology is right there, but i hope it explains what i'm trying to achieve.

The other curve ball is i have 8 seperate text fields. One of those fields is content, with HTML etc.. so it has around 1000+ words. I'm thinking i need to combine all these fields into a single text field, and search on that? (e.g with "copy_to")

I've read so many posts, tried so many things (match phrase prefix, ngram/edge n-gram, shingles), but nothing seems to work. Either the post i'm reading is on and older version of Elasticsearch (i'm on 7.2), or it's not the same as my situation.

So to summarise:

  • Need completion, suggestion, and fuzziness for phrases
  • Searching across multiple text fields

Could someone please point me in the right direction? Ideally, with some sample code, as i'm fairly new to the analyzer/FTS side of things.

Many thanks, i've been stuck on this for days and days, and would really appreciate any help :slight_smile:

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