Should match_phrase be used in if using match_phrase_prefix?


(Jaspreet Singh) #1

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!


(Jaspreet Singh) #2

Anyone any thoughts?


(Abdon Pijpelink) #3

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.

(Jaspreet Singh) #4

Thank you so much. That helps.


(system) #5

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