Does Elastic Search support Mobile Number variation (ex: US Format that has special character)


US mobile phone number data can be saved in multiple formats like (XXX) XXX-XXXX OR +1 (XXX) XXX-XXXX OR XXX-XXX-XXXX OR +1 XXX-XXX-XXXX OR XXXXXXXXXX.

How to ensure which DataType(OOB) would be ideal to be used or any analyser already available to support all above format to return result in search query?

Welcome to our community! :smiley:

You will likely want to save that sort of field as a keyword - Keyword type family | Elasticsearch Guide [7.14] | Elastic

There is no type that automatically handle this but you might be able to use a keyword field with a normal user that removes all non-numeric characters from the indexed token. This does however not handle the case where country code is or is not present, so that may require some normalisation before you index your data. If I you need to support international numbers as well you will most certainly need to normalise the field in your application ahead of indexing as international numbers can have varying lengths and formats.

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