Bug in Kibana 5.4?

I believe this is bug, but maybe it is considered a feature?

Kibana 5.4

I have a Visualization, displaying a Histogram for a Field that represents duration of events. In ElasticSearch, that field is expressed in seconds. For clarity, I convert it to hours, using the JSON input box in the section buckets/X-Axis/Advanced. Like this:

{
    "script": "return doc['duration'].value/3600.0"
}

So far so good.
Problem is that, if I zoom in the Histogram, it goes back to seconds. For example, if I select range from 0 to 5 hours, the resulting plot is for 0 to 5 seconds.

Is it a bug or a feature?
If a bug, has it been fixed in later versions of Kibana?

Thanks a lot.
Jose

I think the script in that JSON input box is run after the range is set, so the range will be in seconds and the script will convert those seconds in hours. I'd suggest using an actual scripted field that returns the duration in hours and use that as the field that you build the visualization on.

Ah, I see. I will try that. Thanks a lot.

Just tried it.
If I define the scripted field like this:

if (!doc['duration'].empty) { 
    return doc['duration'].value/3600.0
}

when I zoom in, it fails completely. I get in Kibana a message like Courier Fetch: 2 of 236 shards failed.

Is it possible it is related to this https://discuss.elastic.co/t/no-result-when-filter-by-scripted-field/197575, also by me :slight_smile: ?

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