# Long data type of es confuses things

**URL:** <https://discuss.elastic.co/t/long-data-type-of-es-confuses-things/85848>\
**Category:** Elasticsearch\
**Created:** [May 16, 2017, 3:29am UTC](https://discuss.elastic.co/t/long-data-type-of-es-confuses-things/85848 "2017-05-16T03:29:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![weixiao](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@weixiao](https://discuss.elastic.co/u/weixiao)\
**Post date:** [May 16, 2017, 3:29am UTC](https://discuss.elastic.co/t/long-data-type-of-es-confuses-things/85848/1 "2017-05-16T03:29:40Z")

</div>

I have a business key id in the fields of my type, which a long data type. And here is the mapping of the corresponding type(part of the mapping):

```
 "npms_id": {
                  "type": "long"
               },

```

Here is the severe problem I came up with: The _npms\_id_ I send to the es server is different from the one in the result JSON returned by Elasticsearch server. For example, I have a query like this:

```
GET /index/type/_search
{
  "query" :{
    "term" : {
      "npms_id": 91447292341973010
    }
  }
}

```

I will not get any result. But if I change the search _npms\_id_, like this:

```
GET /index/type/_search
{
  "query" :{
    "term" : {
      "npms_id": 91447292341973001
    }
  }
}

```

I will get the result of npms\_id: **91447292341973010**. So I doubt that the true value stored in the shards is **91447292341973001** , but what confuses me is why 91447292341973010 is returned or just displayed. In order to get the details of this search, I have done it by enabling the profile function. And the result is [gisted here](https://gist.github.com/axhiao/226923c8a1385fe8768010aaf3381ef3). In addition, the version of my elasticsearch is 5.2.0. Hopefully, this is not a bug problem of this version. Any suggestions are really appreciated here because I'm really stuck on this problem. Thank you guys in advance!

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [May 16, 2017, 4:06pm UTC](https://discuss.elastic.co/t/long-data-type-of-es-confuses-things/85848/2 "2017-05-16T16:06:30Z")

</div>

Hm, I'm not sure... I can't replicate this with a fresh copy of 5.2.0.

Did you happen to use [Transforms](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/mapping-transform.html) in the past, and then upgrade to 5.x? Transforms would allow the source and the indexed data to not match (similar to how analysis can alter text).

---

<div class="post-metadata">

**Author:** ![weixiao](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@weixiao](https://discuss.elastic.co/u/weixiao)\
**Post date:** [May 16, 2017, 4:25pm UTC](https://discuss.elastic.co/t/long-data-type-of-es-confuses-things/85848/3 "2017-05-16T16:25:58Z")

</div>

No, all data are indexed into the fully new cluster of ES-5.2.0. The behavior of es is just weird for now.

---

<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 13, 2017, 4:26pm UTC](https://discuss.elastic.co/t/long-data-type-of-es-confuses-things/85848/4 "2017-06-13T16:26:21Z")

</div>

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