How to return exact match result first then other matches?

I am newbie to elastic. I have data in elasticsearch, with field post_title :

  • Chocolate
  • Hot
  • Homemade

I expect to get 'ho' (exact match) as first result when I search 'ho'

like this:

  1. Homemade
  2. Hot
  3. chocolate

I have tried "match", "match_phrase", "prefix" and "wildcard" in my query, but it doesn't work.

What should I do to put the exact match into first result?

Could you share the mappings of the index and your tried queries?

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