For AI agents: this page is also available as Markdown at /docs/phone-numbers.md. Every docs page is: add .md to its URL. llms.txt lists them all.
Phone numbers
The same number is written (415) 555-2671, +1 415 555 2671 and 415.555.2671, and people search for it by its last four digits. The phone analyzer reads a phone number in any common format and indexes it in its international form (+14155552671), its digits with and without the country code, and its trailing digits down to four. So all three forms match each other, and a search for 2671 finds the number. Extensions are ignored, and digits in other scripts, such as Arabic-Indic or fullwidth, are read as digits.
{"fields": {"phone": {"type": "text", "analyzer": "phone"}}}
Use the phone_search analyzer instead when only a whole number should match: it indexes the international form and the national number, without the trailing-digit forms.
#Other regions
Numbers written without a country code are read as US numbers. For another region, use the tokenizer with default_region:
{
"type": "text",
"analyzer": {"tokenizer": {"name": "phone", "params": {"default_region": "GB"}}}
}
| Param | Tokenizer | Default | Meaning |
|---|---|---|---|
default_region | phone, phone_search | US | ISO 3166 country code for numbers without a + prefix. |
emit_suffixes | phone | true | Index the trailing-digit forms. |
min_suffix_length | phone | 4 | Shortest trailing-digit form indexed. |
#Notes
- A value that is not a valid phone number is indexed as its digits.
- The
phone_digitsfilter keeps a leading+and the digits of each token and can follow any tokenizer. - The OpenSearch
phoneandphone-searchanalyzers and tokenizers map to these, andphone-regionsetsdefault_region. See Through the compatible APIs.