Type: long fields show wrong values in kibana

Hello,
I have noticed a problem with Kibana. Values with "type": "long" do not display correctly.

For example let's take the value "1 671 607 837 241 650 688" displayed in Discover:
InDiscoverOverview
InDiscoverDetail

This is wrong. When I swith to JSON, I see ES returned "1671607837241650700".
EDIT: Oh. I see that's also wrong, because _source was "1671607837241650580".

{
  "_index": "myindex",
  "_type": "_doc",
  "_id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
  "_version": 1,
  "_score": 1,
  "_source": {
    "aaaaa": 123456,
    "eventtime": "1671607837241650580",
    "zzzzz": "abcdef"
  },
  "fields": {
    "aaaaa": [
      123456
    ],
    "eventtime": [
      1671607837241650700
    ],
    "zzzzz": [
      "abcdef"
    ]
  }
}

I tested this using latest ES 7.17 - can't go to 8 until I replace/fix software that went opensearch :frowning:

OpenSearch/OpenDistro are AWS run products and differ from the original Elasticsearch and Kibana products that Elastic builds and maintains. You may need to contact them directly for further assistance.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

Thank you. I rephrased it so its obvious my problem is with ES and that I am staying with ES.

This is related to the maximum precision of JavaScript, check this closed issue and also this issue on Github.

If you are using eventtime just for display, you may change the mapping to keyword.

1 Like

Thank you for the quick reply. I wonder why I failed to find it.

Do you also happen why is fields.eventtime rounded in JSON?
I captured traffic and verified that it really happened on the wire.
I don't see any purpose to ES returning "wrong" values like that.

It is not ES that is returning the wrong value, it is Kibana.

The fields object is created by Kibana using the Fields API, it only exists in the Kibana response.

1 Like

Oh, right. That response comes from Kibana API, not ES API.

When I read " 64 bit number/integer support in Kibana · Issue #40183 · elastic/kibana · GitHub " very carefully, it turns out it describes all of these issues already.

When you said it's Javascripts fault, I (incorrectly) assumed that only the browser part of Kibana will be affected. Does this mean there is Javascript on the Kibana server?

Thank you for bearing with me & I wish a happy new year to you.

Yes, Kibana is built on Node, so it is built on JavaScript.

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