opensearch-project/dashboards-visualizations

[BUG] Duration value indexed as text breaking X-axis in Gantt Chart

Closed this issue · 0 comments

What is the bug?
Duration value returned as text instead of number, quietly breaks X-axis description. Situation occurs when you unknowingly index duration field with mapping type of long or float as a text. What I mean by that is - by mistake you send "duration": "10000" instead of "duration": 10000. It gets handled and parsed on OS side but when it's returned, it's returned as JSON string. String value doesn't get sanitised and it breaks chart x-axis.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. index documents
POST /flights/_doc
{
  "flightNumber": "F103",
  "gate": "G2",
  "time": "2023-01-03T13:30:00",
  "duration": 1200000
}

and

POST /flights/_doc
{
  "flightNumber": "F105",
  "gate": "G1",
  "time": "2023-01-03T15:30:00",
  "duration": "1800000"
}
  1. plot chart with "duration" as duration field

What is the expected behavior?
See screenshots.

What is your host/environment?

  • OS: macOS
  • Plugin: Gantt Chart
  • Version: 2.x

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

All documents with numeric duration.
Screenshot 2023-01-03 at 16 22 24

After one document was indexed with "duration" : "1200000"
Screenshot 2023-01-03 at 16 32 50

Do you have any additional context?
query-response.txt