# Fielddata doesn't agree with \_source for a "long" field

**URL:** <https://discuss.elastic.co/t/fielddata-doesnt-agree-with--source-for-a-long-field/21700>\
**Category:** Elasticsearch\
**Created:** [January 18, 2015, 9:25am UTC](https://discuss.elastic.co/t/fielddata-doesnt-agree-with--source-for-a-long-field/21700 "2015-01-18T09:25:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SergeyTsalkov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergeytsalkov/32/963_2.png) [@SergeyTsalkov](https://discuss.elastic.co/u/SergeyTsalkov)\
**Post date:** [January 18, 2015, 9:25am UTC](https://discuss.elastic.co/t/fielddata-doesnt-agree-with--source-for-a-long-field/21700/1 "2015-01-18T09:25:04Z")

</div>

Hey guys! I'm a newcomer and have been diving deep into ElasticSearch for  
the last week.

Today, I've been trying to debug a maddening issue: I have a "long" field  
that contains decimals between 0 and 1, and sorting on it is not working.  
The records that are exactly 0 or exactly 1 show up in the right place, but  
any values in between are treated as if they were 0 for the purpose of  
sorting. I found the fielddata\_fields setting, and it turns out my hunch  
was right: a given value would show up as 0.155676 in \_source, but  
wrongfully show as 0 in the "fields" hash that I get from fielddata\_fields.

I can't figure out why, and google comes up with nothing. Help would be  
appreciated!

--  
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/8af2c674-c8ac-4942-bc64-7f1310fa7546%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8af2c674-c8ac-4942-bc64-7f1310fa7546%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [January 18, 2015, 9:35am UTC](https://discuss.elastic.co/t/fielddata-doesnt-agree-with--source-for-a-long-field/21700/2 "2015-01-18T09:35:00Z")

</div>

You should change the mapping for this field and use float or double: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#number)

David

> Le 18 janv. 2015 à 10:25, Sergey Tsalkov [stsalkov@gmail.com](mailto:stsalkov@gmail.com) a écrit :
> 
> Hey guys! I'm a newcomer and have been diving deep into Elasticsearch for the last week.
> 
> Today, I've been trying to debug a maddening issue: I have a "long" field that contains decimals between 0 and 1, and sorting on it is not working. The records that are exactly 0 or exactly 1 show up in the right place, but any values in between are treated as if they were 0 for the purpose of sorting. I found the fielddata\_fields setting, and it turns out my hunch was right: a given value would show up as 0.155676 in \_source, but wrongfully show as 0 in the "fields" hash that I get from fielddata\_fields.
> 
> ## I can't figure out why, and google comes up with nothing. Help would be appreciated!
> 
> 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/8af2c674-c8ac-4942-bc64-7f1310fa7546%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8af2c674-c8ac-4942-bc64-7f1310fa7546%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/29EA5BA9-709D-41A0-857F-2C3CA375AF0C%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/29EA5BA9-709D-41A0-857F-2C3CA375AF0C%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![SergeyTsalkov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergeytsalkov/32/963_2.png) [@SergeyTsalkov](https://discuss.elastic.co/u/SergeyTsalkov)\
**Post date:** [January 18, 2015, 9:40am UTC](https://discuss.elastic.co/t/fielddata-doesnt-agree-with--source-for-a-long-field/21700/3 "2015-01-18T09:40:04Z")

</div>

Oh, long is actually an integer field, isn't it? I feel like such an idiot.  
Much gratitude to you!

On Sunday, January 18, 2015 at 1:35:22 AM UTC-8, David Pilato wrote:

> You should change the mapping for this field and use float or double:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#number)
> 
> David
> 
> Le 18 janv. 2015 à 10:25, Sergey Tsalkov \<[stsa...@gmail.com](mailto:stsa...@gmail.com) \<javascript:\>\>  
> a écrit :
> 
> Hey guys! I'm a newcomer and have been diving deep into Elasticsearch for  
> the last week.
> 
> Today, I've been trying to debug a maddening issue: I have a "long" field  
> that contains decimals between 0 and 1, and sorting on it is not working.  
> The records that are exactly 0 or exactly 1 show up in the right place, but  
> any values in between are treated as if they were 0 for the purpose of  
> sorting. I found the fielddata\_fields setting, and it turns out my hunch  
> was right: a given value would show up as 0.155676 in \_source, but  
> wrongfully show as 0 in the "fields" hash that I get from fielddata\_fields.
> 
> I can't figure out why, and google comes up with nothing. Help would be  
> appreciated!
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/8af2c674-c8ac-4942-bc64-7f1310fa7546%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8af2c674-c8ac-4942-bc64-7f1310fa7546%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/8af2c674-c8ac-4942-bc64-7f1310fa7546%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8af2c674-c8ac-4942-bc64-7f1310fa7546%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/94fadaee-047a-43f6-b1b9-e51f08a92ded%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/94fadaee-047a-43f6-b1b9-e51f08a92ded%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:38am UTC](https://discuss.elastic.co/t/fielddata-doesnt-agree-with--source-for-a-long-field/21700/4 "2017-07-06T00:38:11Z")

</div>


