# String to double data type. Issue with range query search

**URL:** https://discuss.elastic.co/t/string-to-double-data-type-issue-with-range-query-search/14744
**Category:** Elasticsearch
**Created:** [December 6, 2013, 5:52am UTC](https://discuss.elastic.co/t/string-to-double-data-type-issue-with-range-query-search/14744 "2013-12-06T05:52:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Hiro\_Gangwani](https://avatars.discourse-cdn.com/v4/letter/h/9fc29f/32.png) [@Hiro\_Gangwani](https://discuss.elastic.co/u/Hiro_Gangwani)
#### Post date: [December 6, 2013, 5:52am UTC](https://discuss.elastic.co/t/string-to-double-data-type-issue-with-range-query-search/14744/1 "2013-12-06T05:52:00Z")

</div>

Dear Team,

I have indexed set of documents having multiple attributes having data type  
as String. For some attributes value is passed as 13.0 but stored as  
string. when i perform the range query operation on such attributes, values  
are getting converted into asci format.

e.g if search range values specified as 1.0 to 3.0 documents having value  
as 13.0 is also getting fetched. I know it is mistake as my end. Is there  
way to update the field data type from String to Double. I tried updating  
the attribute data with double value but still results are coming. Is it  
like whatever data type has been set initially, there is no support to  
change the data type afterwards. Is there workaround for this issue.

Please suggest me the solution.

Thanks,

Hiro

--  
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/317bb4fb-ce39-421f-a465-c438c07f6287%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/317bb4fb-ce39-421f-a465-c438c07f6287%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [December 6, 2013, 8:02am UTC](https://discuss.elastic.co/t/string-to-double-data-type-issue-with-range-query-search/14744/2 "2013-12-06T08:02:10Z")

</div>

Hey,

you have to create a new index, with a new mapping and reindex your data.  
This thread might help you  
[https://groups.google.com/d/msg/elasticsearch/lbPGWz5-4sc/FnFzWhMyL1oJ](https://groups.google.com/d/msg/elasticsearch/lbPGWz5-4sc/FnFzWhMyL1oJ)

--Alex

On Fri, Dec 6, 2013 at 6:52 AM, Hiro Gangwani [hiro.gangwani@gmail.com](mailto:hiro.gangwani@gmail.com)wrote:

> Dear Team,
> 
> I have indexed set of documents having multiple attributes having data  
> type as String. For some attributes value is passed as 13.0 but stored as  
> string. when i perform the range query operation on such attributes, values  
> are getting converted into asci format.
> 
> e.g if search range values specified as 1.0 to 3.0 documents having value  
> as 13.0 is also getting fetched. I know it is mistake as my end. Is there  
> way to update the field data type from String to Double. I tried updating  
> the attribute data with double value but still results are coming. Is it  
> like whatever data type has been set initially, there is no support to  
> change the data type afterwards. Is there workaround for this issue.
> 
> Please suggest me the solution.
> 
> Thanks,
> 
> Hiro
> 
> --  
> 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/317bb4fb-ce39-421f-a465-c438c07f6287%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/317bb4fb-ce39-421f-a465-c438c07f6287%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAGCwEM\_WHobmV\_j1cmH%2BKN7-23nhDaPoQ%3DC7vn-FLzKH9r-EmQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM_WHobmV_j1cmH%2BKN7-23nhDaPoQ%3DC7vn-FLzKH9r-EmQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:02am UTC](https://discuss.elastic.co/t/string-to-double-data-type-issue-with-range-query-search/14744/3 "2017-07-06T02:02:55Z")

</div>


