# Difference between Top Hit of Metric Visualization and Top Hit in Metric Visual Builder

**URL:** <https://discuss.elastic.co/t/difference-between-top-hit-of-metric-visualization-and-top-hit-in-metric-visual-builder/192016>\
**Category:** Kibana\
**Created:** [July 24, 2019, 11:46am UTC](https://discuss.elastic.co/t/difference-between-top-hit-of-metric-visualization-and-top-hit-in-metric-visual-builder/192016 "2019-07-24T11:46:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![saif3r](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@saif3r](https://discuss.elastic.co/u/saif3r)\
**Post date:** [July 24, 2019, 11:46am UTC](https://discuss.elastic.co/t/difference-between-top-hit-of-metric-visualization-and-top-hit-in-metric-visual-builder/192016/1 "2019-07-24T11:46:08Z")

</div>

Hello All,

I have an issue in understanding how exactly Metric in Visual Builder settings work. The easiest way would be to explain it on an example. Here's my data set:

```
{
    "manufacure_date": "2019-07-01T08:00:00.000Z",
	"modifieddate": "2019-07-01T08:58:56.000Z",
    "name": "Car1",
	"manufactured": 22
	"target": 30
	"gap": 8
  } {
    "manufacure_date": "2019-07-01T09:00:00.000Z",
	"modifieddate": "2019-07-01T09:56:02.000Z",
    "name": "Car1",
	"manufactured": 16
	"target": 30
	"gap": 14
  } {
    "manufacure_date": "2019-07-01T10:00:00.000Z",
	"modifieddate": "2019-07-01T10:27:06.000Z",
    "name": "Car1",
	"manufactured": 12
	"target": 30
	"gap": 18
  }

```

Data at source is updated every 3-5 minutes. I run my pipeline every 2 minutes, visualization is refreshed every 60 seconds.  
The way we gather data is simple. We take `modifieddate` and based on a key, that contains two fields: `name` and `manufacure_date` we update the following fields: `modifieddate`, `manufactured` and `gap` which is calculated on a query level.  
There are three metrics on my visualization: `manufactured`, `target` and `gap`. They are visualized using Metric and Top Hit aggregation method sorted on `modifieddate` with size of 1.  
Just like that:  
 ![gap_metric](https://us1.discourse-cdn.com/elastic/original/3X/8/1/812d0778e697d0e609393bf7f7cd15771a78531f.png)

Date filter is set to `Last 1 hour`. It works just fine, but recently for `Gap` I decided to use Visual Builder Metric, as it provides nice possibilities of conditional coloring with custom color pallet. I used the same Top Hit Aggregation, same fields and settings. Details:  
 ![gap_vsb_1](https://us1.discourse-cdn.com/elastic/original/3X/f/2/f21bd44594ab8eeb65097a76efbbd137fd6872fb.png)  
 ![gap_vsb_2](https://us1.discourse-cdn.com/elastic/original/3X/5/e/5e097a1e769e78ff4dc0d9fe041651f2f75c1109.png)

Everything works fine during most of the hour, but once full hour passes, Visual Builder Gap changes to 0, while Metric Gap sits with correct value based on Last Hit. Once the new record comes into index (with `modifieddate` from same hour as we currently have), VSB Gap shows correct value. I am not sure what might cause that, so if anyone could point me where'd the mistake, I'd appreciate it. I'm quite fresh to VSB so my understanding might be wrong.  
Here's a breakdown that might put some light on what happens:  
 ![gap_breakdown](https://us1.discourse-cdn.com/elastic/original/3X/5/5/554d5a303ec9df268a77960190d44a3509776c2b.png)

Thanks!

Note: I just changed VSB interval to `1y`. If my understanding is correct, it should work properly except for new eyars eve, 00:00:00 🙂

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [July 24, 2019, 8:46pm UTC](https://discuss.elastic.co/t/difference-between-top-hit-of-metric-visualization-and-top-hit-in-metric-visual-builder/192016/2 "2019-07-24T20:46:52Z")

</div>

Hey @saif3r would you mind seeing if the system clocks for the server running Kibana and the computer running the browser and accessing Kibana are in sync?

---

<div class="post-metadata">

**Author:** ![saif3r](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@saif3r](https://discuss.elastic.co/u/saif3r)\
**Post date:** [July 29, 2019, 8:04am UTC](https://discuss.elastic.co/t/difference-between-top-hit-of-metric-visualization-and-top-hit-in-metric-visual-builder/192016/3 "2019-07-29T08:04:04Z")

</div>

Hello @Brandon_Kobel,

There was a 20s desync, which I fixed immediately.

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [July 29, 2019, 2:10pm UTC](https://discuss.elastic.co/t/difference-between-top-hit-of-metric-visualization-and-top-hit-in-metric-visual-builder/192016/4 "2019-07-29T14:10:15Z")

</div>

Did adjusting the system clocks to be in sync remedy the issue that you're seeing?

---

<div class="post-metadata">

**Author:** ![saif3r](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@saif3r](https://discuss.elastic.co/u/saif3r)\
**Post date:** [July 30, 2019, 8:41am UTC](https://discuss.elastic.co/t/difference-between-top-hit-of-metric-visualization-and-top-hit-in-metric-visual-builder/192016/5 "2019-07-30T08:41:30Z")

</div>

Hi @Brandon_Kobel,

After i realized what Interval means in VSB, I changed it to 1y (from 1h), and after that it seems like Top Hit works properly.  
Thank you.

---

<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:** [August 27, 2019, 8:41am UTC](https://discuss.elastic.co/t/difference-between-top-hit-of-metric-visualization-and-top-hit-in-metric-visual-builder/192016/6 "2019-08-27T08:41:34Z")

</div>

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