Doc['field_name'] returns unexpected big number

Hey guys,
I am using ES 1.7. I run following query and i expect to get 1 which is current popularity for it. but it returns 4607464916994563600.

POST /myIndex/en/_search
{
  "size": 1,
  "script_fields": {
    "toTestField": {
      "script": "doc['popularity'].value"
    }
  }
}

Result:

{
  "took": 87,
  "timed_out": false,
  "_shards": {
    "total": 2,
    "successful": 2,
    "failed": 0
  },
  "hits": {
    "total": 3059534,
    "max_score": 1,
    "hits": [
      {
        "_index": "myIndex",
        "_type": "en",
        "_id": "12345",
        "_score": 1,
        "fields": {
          "toTestField": [
            4607464916994563600
          ]
        }
      }
    ]
  }
}

Any ideas, why this happen?

Could you please also post a minimal set of indexing requests so following your search snippets becomes easier?

Thanks,
Isabel

You might be hitting the problem described in this post: Sum Aggregation returning very small, unrelated values

Upgrading to 2.4 and reindexing should solve the issue. If you aren't able to upgrade to 2.4 then re-indexing with a defined mapping and not relying on dynamic mapping should help avoid this issue

Yes, apparently this was ES 1.7 bug. I couldn't upgrade ES right now. I just disable the dynamic mapping and reindex all data. Until upgrade it should be fine