elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.82k stars 8.2k forks source link

Auto-indent rounds large numbers #101391

Open EmilBode opened 3 years ago

EmilBode commented 3 years ago

Kibana version: 7.13.1 (newest), also observed on 7.12.0

Elasticsearch version: 7.13.1, or 7.12.0

Server OS version: Windows 10 (64-bit)

Browser version: Chrome (64-bit, newest)

Browser OS version: Windoes 10 (64-bit)

Original install method (e.g. download page, yum, from source, etc.): Download (from https://www.elastic.co/downloads/kibana)

Describe the bug:

Steps to reproduce:

  1. Go to console
  2. Write some query, including a large number
  3. Hit Ctrl+I, or hover over the wrench and click "Auto indent"

Expected behavior: I'd expect allignment, newlines and indentation to be fixed/modified, but my query to be otherwise identical

Actual baheviour Indentation is modified, but large numbers are also rounded. This leads to different results.

Example: When using pagination, the search_after parameter needs to be exactly copied. The query I originally wanted to execute:

GET /_search
{
  "pit": {
    "id": "15izAwEEdGVzdBZkOHNKLTlvV1JYbU9MWE5aaHRCQTVnABZHZFlxQXNXcFNmU0xFUm9kR3hpR1JBAAAAAAAAABeSFkluaW8yNEVBUkFHVXlZWlNfb2dRNHcAARZkOHNKLTlvV1JYbU9MWE5aaHRCQTVnAAA="
  },
  "query": {
    "match_all": {}
  },
  "size": 1,
  "sort": {
    "timestamp": {
      "order": "desc"
    }
  },
  "search_after": [
          -9223372036854775808,
          1
        ]
}

was modified to this:

GET /_search
{
  "pit": {
    "id": "15izAwEEdGVzdBZkOHNKLTlvV1JYbU9MWE5aaHRCQTVnABZHZFlxQXNXcFNmU0xFUm9kR3hpR1JBAAAAAAAAABeSFkluaW8yNEVBUkFHVXlZWlNfb2dRNHcAARZkOHNKLTlvV1JYbU9MWE5aaHRCQTVnAAA="
  },
  "query": {
    "match_all": {}
  },
  "size": 1,
  "sort": {
    "timestamp": {
      "order": "desc"
    }
  },
  "search_after": [
    -9223372036854776000,
    1
  ]
}

The two seem very alike. Yet the first one ran as expected, while the second one gave me an error, due to the now rounded number causing an overflow.

See also https://github.com/elastic/elasticsearch/issues/73772, where I originally suspected something competely different

TinaHeiligers commented 3 years ago

@elastic/es-ui Is console still in your domain as per CODEOWNERS?

tsullivan commented 3 years ago

cc @elastic/elastic-ui it looks like we don't have a team: label for you yet

elasticmachine commented 3 years ago

Pinging @elastic/kibana-stack-management (Team:Stack Management)

cjcenizal commented 3 years ago

@TinaHeiligers @tsullivan ES UI is now @elastic/kibana-stack-management 😄

And yes, we still maintain all Dev Tools including Console.

I'm pretty sure @elastic/elastic-ui is the original alias for the Kibana team from back in the day.

andrew-moldovan commented 3 years ago

Pings every ui engineer in the company... 😂

pgayvallet commented 3 years ago

but large numbers are also rounded. This leads to different results.

>> Number.isSafeInteger(-9223372036854775808)
false
>> -9223372036854775808 === -9223372036854776000
true

This is probably caused by the fact that the reindent script is parsing the JSON to perform the reindent, resulting on non-safe integer being truncated.

Related to https://github.com/elastic/kibana/issues/40183

Note that console was not supposed to be impacted by the bigint JS limitations, as the input text is send as-is to ES, however, I guess any code transformation we're performing during the reindex is effectively impacted by these problems.

Edited https://github.com/elastic/kibana/issues/40183 to reflect that.

alisonelizabeth commented 1 year ago

Note that this issue appears to occur now regardless if "auto indent" is used

elasticmachine commented 1 month ago

Pinging @elastic/kibana-management (Team:Kibana Management)