# Text search large number field

**URL:** <https://discuss.elastic.co/t/text-search-large-number-field/1075>\
**Category:** Elasticsearch\
**Created:** [May 21, 2015, 10:29am UTC](https://discuss.elastic.co/t/text-search-large-number-field/1075 "2015-05-21T10:29:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Craig\_Berry](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@Craig\_Berry](https://discuss.elastic.co/u/Craig_Berry)\
**Post date:** [May 21, 2015, 10:29am UTC](https://discuss.elastic.co/t/text-search-large-number-field/1075/1 "2015-05-21T10:29:59Z")

</div>

Hi there,

I want to be able to provide a text search against a document that contains a large number (10+ digits) but running into some conversion issues with my mapping.

Scenario: User can submit a value of 1234567890 in a field and then wants to be able to return that document by searching for the exact text "1234567890".

In my current implementation, I'm storing the value in a double typed field (since the field could contain floating point values) with a sub field that copies the string value to another field with a custom analyser that splits the number by decimal point:

```
 "numberField": {
      "type": "double",
      "fields": {
              "asText": {
                     "type": "string",
                     "copy_to": [
                          "all_numbers"
                     ]
               }
},
"all_numbers": {
       "type": "string",
       "analyzer": "number_analyzer"
}

```

So this means if the value is 31, then it's stored as 31.0 in numberField and then in all\_numbers as "31" and "0". So a text search against the all\_numbers field will return this document.

However, when the number value is very large, it seems the double conversion to string is using the 1.XEY notation, e.g. 123456789 becomes 1.23456789E9. This means what's stored in my all\_numbers field is "1" and "23456789E9" and so a text search of "1234567890" returns 0 hits.

At this point I'm just wondering whether my source document should contain the value twice, once as a number and once as string and avoid needing to do any custom analysis, however this does mean moving this logic to the application layer when I'd rather Elastic could just handle it.

Any other suggestions on how I could get Elastic to store the value as I desire?

FYI I have other custom analysers running on the \_all field that means searching that field doesn't return the 'number' either.

TIA

Craig

---

<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:12am UTC](https://discuss.elastic.co/t/text-search-large-number-field/1075/2 "2017-07-06T00:12:42Z")

</div>


