I have incoming data with a field called "PhoneNumber". It is a String and can have numeric and special chars - ex: 123-456-7890, +123-456-7890. I have the current requirement for searching:
RangeQuery - ex: 123456-99999999 will return all phonenumbers inclusive for that range
RegexQuery - ex: 123***4444 will return via regex 123[0-9][0-9][0-9]4444 all the phone numbers I initially tried the mapping:
"PhoneNumber" :{ "type":"text", "fields": { "textNum": { "type": "text", "analyzer": "phone_analyzer" }}}
“phone_analyzer":{ "char_filter":["digits"], "type":"custom", "tokenizer":"standard"}
"char_filter":{ "digits": { "type": "pattern_replace", "pattern": "[^0-9]", "replacement":""}}
Which will give me the TEXT version of only digits which can satisfy query via regex. However, I discovered that I can't do the analyzer/normalizer on numerics/longs. What can I do to have the numerical versions of the value of the text? Some examples would be hugely appreciated. Range query only works on numerical so thats why I have to have a number format to search. Thanks!