# NumberFormatException when using regex filter with int field

**URL:** <https://discuss.elastic.co/t/numberformatexception-when-using-regex-filter-with-int-field/21531>\
**Category:** Elasticsearch\
**Created:** [January 8, 2015, 8:56am UTC](https://discuss.elastic.co/t/numberformatexception-when-using-regex-filter-with-int-field/21531 "2015-01-08T08:56:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AK\_2](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@AK\_2](https://discuss.elastic.co/u/AK_2)\
**Post date:** [January 8, 2015, 8:56am UTC](https://discuss.elastic.co/t/numberformatexception-when-using-regex-filter-with-int-field/21531/1 "2015-01-08T08:56:40Z")

</div>

Hello,  
I am using ES Java api to run queries against ES. I have a field in ES  
which has int data. When I run regex filter on that field im getting number  
format exception.  
Can't we use regex with numbers? is it only for string fields?  
Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4f797a64-273b-468e-af66-05063c5e982d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4f797a64-273b-468e-af66-05063c5e982d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Zippy](https://avatars.discourse-cdn.com/v4/letter/z/13edae/32.png) [@Zippy](https://discuss.elastic.co/u/Zippy)\
**Post date:** [January 8, 2015, 9:00am UTC](https://discuss.elastic.co/t/numberformatexception-when-using-regex-filter-with-int-field/21531/2 "2015-01-08T09:00:18Z")

</div>

Yes. copy the int field value to a string field with copy\_to or manually.

Am Donnerstag, 8. Januar 2015 09:56:40 UTC+1 schrieb AK:

> Hello,  
> I am using ES Java api to run queries against ES. I have a field in ES  
> which has int data. When I run regex filter on that field im getting number  
> format exception.  
> Can't we use regex with numbers? is it only for string fields?  
> Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c58c0d9a-0bb3-428d-9fa2-4ad45e662e14%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c58c0d9a-0bb3-428d-9fa2-4ad45e662e14%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:40am UTC](https://discuss.elastic.co/t/numberformatexception-when-using-regex-filter-with-int-field/21531/3 "2017-07-06T00:40:08Z")

</div>


