# Changing the datatype of Tokens using analyzers

**URL:** <https://discuss.elastic.co/t/changing-the-datatype-of-tokens-using-analyzers/132983>\
**Category:** Elasticsearch\
**Created:** [May 23, 2018, 11:19am UTC](https://discuss.elastic.co/t/changing-the-datatype-of-tokens-using-analyzers/132983 "2018-05-23T11:19:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aparna\_KP](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Aparna\_KP](https://discuss.elastic.co/u/Aparna_KP)\
**Post date:** [May 23, 2018, 11:19am UTC](https://discuss.elastic.co/t/changing-the-datatype-of-tokens-using-analyzers/132983/1 "2018-05-23T11:19:18Z")

</div>

Hi,

I came across a scenario where one of the account teams that I am working with, need the indexed tokens to behave in 2 different ways. The field receives data in the form -\> "D:546789". The field has a "text" datatype in the mapping. This field right now has a path\_hierarchy tokenizer with ":" as delimiter. The new requirement is to separate the string at ":", index the tokens "D" and "546789". But, this number part of the token must exhibit all the numeric properties. The token "546789" must behave as a "long" or "integer" type and must be queryable in a range query.  
To summarise, is it possible to change the datatype of a text field (that has a number in it) that is analysed to form tokens and make the tokens (numbers) behave as long/integer through the use of any of the token filters or any other means??. The Elasticsearch version is 5.4.2.

Thanks  
Aparna

---

<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 20, 2018, 11:19am UTC](https://discuss.elastic.co/t/changing-the-datatype-of-tokens-using-analyzers/132983/2 "2018-06-20T11:19:21Z")

</div>

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