# Analyzer to keep integers/numeric inputs

**URL:** <https://discuss.elastic.co/t/analyzer-to-keep-integers-numeric-inputs/102835>\
**Category:** Elasticsearch\
**Created:** [October 5, 2017, 11:47am UTC](https://discuss.elastic.co/t/analyzer-to-keep-integers-numeric-inputs/102835 "2017-10-05T11:47:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebsaral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebsaral/32/22789_2.png) [@ebsaral](https://discuss.elastic.co/u/ebsaral)\
**Post date:** [October 5, 2017, 11:47am UTC](https://discuss.elastic.co/t/analyzer-to-keep-integers-numeric-inputs/102835/1 "2017-10-05T11:47:54Z")

</div>

How can I create an analyzer to keep integers?

I am using `simple` analyzer to get tokens, but `hello1` becomes [`hello`] but I wanna keep `1` as well like [`hello1`] when getting tokenized.

Any way of doing this?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 5, 2017, 12:09pm UTC](https://discuss.elastic.co/t/analyzer-to-keep-integers-numeric-inputs/102835/2 "2017-10-05T12:09:28Z")

</div>

Does the `standard` analyzer helps for this?

---

<div class="post-metadata">

**Author:** ![ebsaral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebsaral/32/22789_2.png) [@ebsaral](https://discuss.elastic.co/u/ebsaral)\
**Post date:** [October 5, 2017, 12:21pm UTC](https://discuss.elastic.co/t/analyzer-to-keep-integers-numeric-inputs/102835/3 "2017-10-05T12:21:16Z")

</div>

It works with `standard` analyzer normally, when using English. But when I use Japanese, standard does not work for me since it converts every Japanese letter to a token. Therefore I chose `simple` to go with, but now I encountered with this alphanum token issue.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 5, 2017, 1:50pm UTC](https://discuss.elastic.co/t/analyzer-to-keep-integers-numeric-inputs/102835/4 "2017-10-05T13:50:53Z")

</div>

Did you try the letter Tokenizer? [https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-letter-tokenizer.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-letter-tokenizer.html)

Not sure it works though for this use case.

May be @johtani has better ideas?

---

<div class="post-metadata">

**Author:** ![ebsaral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebsaral/32/22789_2.png) [@ebsaral](https://discuss.elastic.co/u/ebsaral)\
**Post date:** [October 5, 2017, 2:02pm UTC](https://discuss.elastic.co/t/analyzer-to-keep-integers-numeric-inputs/102835/5 "2017-10-05T14:02:58Z")

</div>

`letter` tokenizer does not also help with `hello123` -\> `hello123` conversion. It makes it `hello123` -\> `hello`.

I tried to use pattern analyzer here with flags `UNICODE_CASE|UNICODE_CHARACTER_CLASS` and pattern `\\W|\\w+` but it does this: `Test Contact123` -\> [`test contact123`] where I wanna have [`test`, `contract123`]

I was never good at regex, can't find the way to implement this.

---

<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:** [November 2, 2017, 2:03pm UTC](https://discuss.elastic.co/t/analyzer-to-keep-integers-numeric-inputs/102835/6 "2017-11-02T14:03:03Z")

</div>

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