# Token Filter: catenate\_numbers - spaces included?

**URL:** <https://discuss.elastic.co/t/token-filter-catenate-numbers-spaces-included/181341>\
**Category:** Elasticsearch\
**Created:** [May 16, 2019, 9:04am UTC](https://discuss.elastic.co/t/token-filter-catenate-numbers-spaces-included/181341 "2019-05-16T09:04:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![doaks](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@doaks](https://discuss.elastic.co/u/doaks)\
**Post date:** [May 16, 2019, 9:04am UTC](https://discuss.elastic.co/t/token-filter-catenate-numbers-spaces-included/181341/1 "2019-05-16T09:04:59Z")

</div>

According here [Word delimiter token filter | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-word-delimiter-tokenfilter.html)

> `catenate_numbers`  
> If `true` causes maximum runs of number parts to be catenated: \> "500-42" ⇒ "50042". Defaults to `false` ."

I would like to know if there is a way to include \s+ (any number of spaces) with '-' as characters to collapse when catenating number strings.

Phone numbers are often written like 07 9833-4266 and it would be good if that could be collapsed to a single string 0798334266.

Is there a way?

---

<div class="post-metadata">

**Author:** ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)\
**Post date:** [May 24, 2019, 2:00pm UTC](https://discuss.elastic.co/t/token-filter-catenate-numbers-spaces-included/181341/2 "2019-05-24T14:00:44Z")

</div>

Hi @doaks,

It seems `catenate_all` would work for you. Please, find the example below:

```auto
GET _analyze
{
  "text": [
    "07 9833-4266",
    "+1 (407) 284-1234"
  ],
  "tokenizer": "keyword",
  "filter": [
    {
      "type": "word_delimiter",
      "catenate_all": true,
      "split_on_case_change": false,
      "split_on_numerics": false,
      "generate_word_parts": false,
      "generate_number_parts": false
    }
  ]
}

```

The result is:

```auto
{
  "tokens" : [
    {
      "token" : "0798334266",
      "start_offset" : 0,
      "end_offset" : 12,
      "type" : "word",
      "position" : 0
    },
    {
      "token" : "14072841234",
      "start_offset" : 14,
      "end_offset" : 30,
      "type" : "word",
      "position" : 1
    }
  ]
}

```

I hope it helps!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 21, 2019, 2:00pm UTC](https://discuss.elastic.co/t/token-filter-catenate-numbers-spaces-included/181341/3 "2019-06-21T14:00:46Z")

</div>

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