Reparsing of Transformed Data Leading to Incorrect Results #154116
Labels
bug
Fixes for quality problems that affect the customer experience
Feature:Vega
Vega visualizations
impact:low
Addressing this issue will have a low level of impact on the quality/strength of our product.
Team:Visualizations
Visualization editors, elastic-charts and infrastructure
triage_needed
Kibana version:
[6.8.23]
Vega Schema:
https://vega.github.io/schema/vega/v3.json
Elasticsearch version:
[6.8.23]
Server OS version:
Centos 5?
Browser version:
Firefox 111
Browser OS version:
Windows 11
Describe the bug:
When you refresh Kibana inside a certain timeframe it does not requery the data from ES, but it passes the already transformed data back through the vega spec, meaning any in-place calculations on fields are done on the already updated data. This only occurs on data that is retrieved from ES.
As a trivial example, simply take the cardinality of some value in an index and add some number to that count value:
{ "name": "countdata2", "url": { "index": "someindex", "body": {"aggs": {"count": {"cardinality": {"field": "name"}}}, "size": 0} }, "format": {"property": "aggregations.count"}, "transform": [{"type": "formula", "expr": "datum.value + 10", "as": "value"}] }
The first time this runs you get the expected result. X+10 = Y
If you refresh the kibana view in the correct time frame you will not see an API call to fetch the data again and you will end up with Y+10=Z
You can keep refreshing if you get the timing right and keep adding to the data.
However if you do the same thing based on a "values" set like
{ "name": "countdata1", "values": [{"value": 100}], "transform": [{"type": "formula", "expr": "datum.value + 10", "as": "value"}] }
You will only ever get 110. It will never change.
If you make transformations that perhaps check into the structure of your data and change that structure in place then you will actually end up with errors.
{ "type": "formula", "as": "somefield", "expr": "length(datum.somefield.buckets) == 0 ? [{'key':'none'}] : datum.somefield.buckets" }
All of these issues can be written around by ensuring that you never change some value in place but it's a PITA to have found this out so late in the game now and have to find all examples where data might end up misconstrued.
Expected behavior:
Either the ES data should be requeried each refresh, or the original ES data should be used and not the transformed data.
The text was updated successfully, but these errors were encountered: