I am matching the phone numbers and ssn that start with '40'. For ssn I am getting the correct matching count. For the phone number, I am not getting the correct matching count, as the phone number contains hyphens '-' in between the phone number. Example: '403-517-2323'.
When I search for a phone number that starts with '40' it includes the phone number that has '40' in between after the hyphen. Example: '222-401-8120' and '823-093-4012'.
How can I exclude matching in between and match only at the start of the phone number?
Below is the query I am trying>
GET emp_details_1_1/_msearch
{"index": "emp_details_1_1"}
{"_source":[],"size":0,"min_score":1,"query":{"multi_match":{"query":"40","fields":["ssn"],"type":"phrase_prefix"}}}
{"index": "emp_details_1_1"}
{"_source":[],"size":0,"min_score":1,"query":{"multi_match":{"query":"21","fields":["phone"],"type":"phrase_prefix"}}}