# Bug in Kibana 5.4?

**URL:** <https://discuss.elastic.co/t/bug-in-kibana-5-4/197961>\
**Category:** Kibana\
**Created:** [September 4, 2019, 12:56am UTC](https://discuss.elastic.co/t/bug-in-kibana-5-4/197961 "2019-09-04T00:56:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcaballero](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@jcaballero](https://discuss.elastic.co/u/jcaballero)\
**Post date:** [September 4, 2019, 12:56am UTC](https://discuss.elastic.co/t/bug-in-kibana-5-4/197961/1 "2019-09-04T00:56:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [September 6, 2019, 10:51am UTC](https://discuss.elastic.co/t/bug-in-kibana-5-4/197961/2 "2019-09-06T10:51:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jcaballero](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@jcaballero](https://discuss.elastic.co/u/jcaballero)\
**Post date:** [September 6, 2019, 2:12pm UTC](https://discuss.elastic.co/t/bug-in-kibana-5-4/197961/3 "2019-09-06T14:12:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jcaballero](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@jcaballero](https://discuss.elastic.co/u/jcaballero)\
**Post date:** [September 6, 2019, 8:35pm UTC](https://discuss.elastic.co/t/bug-in-kibana-5-4/197961/4 "2019-09-06T20:35:26Z")

</div>

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](https://discuss.elastic.co/t/no-result-when-filter-by-scripted-field/197575), also by me 🙂 ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 4, 2019, 8:35pm UTC](https://discuss.elastic.co/t/bug-in-kibana-5-4/197961/5 "2019-10-04T20:35:35Z")

</div>

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