Should match_phrase be used in if using match_phrase_prefix?

I want to support partial name searches against authors field.
SO I have something like ...

                {"match": {"authors": "schm"}},
                {"match_phrase": {"authors": "schm"}},
                {"match_phrase_prefix": {"authors": {
                "query" : "schm",
                "boost":10,
                "max_expansions" : 10
            }}}

I had a couple of clarifications to seek ...

  1. Do I need both match and match_phrase? I think yes. If searching for "Chris John", "match_phrase" wont give back hits for "Chris", and "match" wont give preference to simultaneous occurance of "Chris John".
  2. More importantly, if I have match_phrase_prefix, do I need "match_phrase" since match_phrase_prefix builds up on original phrase anyway, somewhat like wildcard?

Thanks!

Anyone any thoughts?

It all depends on the business rules behind your partial name search of course, but:

  1. Yes, you are right. If you also want to find documents that contain just parts of the phrase, then you also need to include a match
  2. I don't think you need the match_phrase, as the match_phrase_prefix will already score exact matches higher than "wildcard" matches.

Thank you so much. That helps.

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