Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panel that shows the latest value of a field #678

Closed
elvarb opened this issue Nov 8, 2013 · 72 comments
Closed

Panel that shows the latest value of a field #678

elvarb opened this issue Nov 8, 2013 · 72 comments

Comments

@elvarb
Copy link

elvarb commented Nov 8, 2013

In some cases you want to have a dashboard that shows the latest value of a field. For example you have concurrent connections and want the Ops team to see the current status at a glance. Same if you have calls waiting from the phone system. Would work well with the metric filter also.

Letter size scale to the size of the panel.
Custom font color.
Possibly if it's a number a different color if the value is greater than some value.

@turf00
Copy link

turf00 commented Apr 18, 2014

+1 This feature would be useful to our team as well. We would like to see the last value of a particular field grouped by another field.

@kjellski
Copy link

+1 for this, would be a great addition for our dashboard as well!

It's also usefull for everything that has a state and is logging that state.

@sahilthapar
Copy link

👍

1 similar comment
@jeremybz
Copy link

+1

@webmstr
Copy link

webmstr commented Apr 16, 2015

I was hoping to work around this in a saved search by setting "size": 0 in the definition, but it's not respected there.

@elvarb
Copy link
Author

elvarb commented Apr 16, 2015

Grafana has a single stat panel that is exactly what is needed in kibana

@jgogstad
Copy link

jgogstad commented Jul 8, 2015

+1

1 similar comment
@andrewvc
Copy link
Contributor

+1

@andrewvc
Copy link
Contributor

this is possible by combining filter, terms, and top_hits aggs, as in the example below. While the agg delivers the document, not the metric (top hits does not allow sub-aggs), that can be extracted in the JS code. See the example query below:

{
  "query": {
    "filtered": {
      "query": {
        "query_string": {
          "query": "*",
          "analyze_wildcard": true
        }
      },
      "filter": {
        "bool": {
          "must": [
            {
              "query": {
                "query_string": {
                  "analyze_wildcard": true,
                  "query": "*"
                }
              }
            }
          ],
          "must_not": []
        }
      }
    }
  },
  "size": 0,
  "aggs": {
    "3": {
      "filter": {
        "term": {"tags": "apache_stats"}
      },
      "aggs": {
        "2": {
          "terms": {
            "field": "@host.raw",
            "size": 5
          },
          "aggs": {
            "1": {
              "top_hits": {
                "sort": [{
                    "@timestamp": {"order": "desc"}
                }],
                "size": 1

              }
            }
          }
        }
      }
    }
  }
}

@rashidkpc
Copy link
Contributor

Once #3546 is in this can be closed.

@yehosef
Copy link

yehosef commented Aug 25, 2015

I'm curious why is this being approached as an aggregation? It's a simple query. We have a queue that processes log data and has a timestamp value stored that is the latests time processed (we then have a cron that takes the the next chunk of time to process and increases the time reference. For this case, the query would look like:

GET metrics-*/_search
{
  "size": 1, 
  "fields": ["redis.current_time","@timestamp"], 
  "sort": [
    {
      "@timestamp": {
        "order": "desc"
      }
    }
  ]
}

What about an approach like this? It should have a different metric type. Maybe it could be called "single value" and it would have a sort field and direction or querystring field (like a filter). This would let it be more flexible and the interface and query would be very simple.

@andrewvc
Copy link
Contributor

@yehosef the reason being that aggregations can be more easily composed
with other aggregations. You're right that the query is simpler it just
isn't as generic in the context of kibana

On Tuesday, August 25, 2015, yehosef notifications@github.com wrote:

I'm curious, why is this being approached as an aggregation? It's a simple
query. We have a queue that processes log data and has a timestamp value
stored that is the latests time processed (we then have a cron that takes
the the next chunk of time to process and increases the time reference. For
us the query would look like:

GET metrics-*/_search
{
"size": 1,
"fields": ["redis.current_time","@timestamp"],
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}

What about an approach like this? It should have a different metric type -
maybe "latest".


Reply to this email directly or view it on GitHub
#678 (comment).

@yehosef
Copy link

yehosef commented Aug 25, 2015

@andrewvc - this could be - but this is a very specific situation where I need a single value from the original data, the opposite of aggregations. It's seems heavy/silly to make it be an aggregation just because everywhere else it's an aggregation - when a single value solves this problem better.

@taraspos
Copy link

taraspos commented Sep 3, 2015

I was able to configure latest response for host with configuration similar as @andrewvc . Check image below.

https://cloud.githubusercontent.com/assets/9948629/9663658/27bedefc-526e-11e5-839f-f64c827a27d2.png

@AnkurMathur14
Copy link

It would be really nice if this feature is included in up commimg kibana version

@bvorosadmin
Copy link

+1 for the ability to display the latest value.

@richard-hulm
Copy link

+1

3 similar comments
@steveainuk
Copy link

+1

@anoinoz
Copy link

anoinoz commented Oct 26, 2015

+1

@raffis
Copy link

raffis commented Nov 4, 2015

+1

@markwalkom
Copy link
Contributor

+1 for this from me, it'd be a great metric addition.

@rashidkpc rashidkpc added v5.1.0 and removed v4.5.0 labels Nov 23, 2015
@jeromefroe
Copy link

+1

1 similar comment
@aalexgabi
Copy link

+1

@Bargs
Copy link
Contributor

Bargs commented Mar 16, 2017

@karthikbaputj 5.3 #7302

@karthikbaputj
Copy link

Thank you @Bargs , Is top_hits only supposed to work on Data table visualization ? If I try to use it on Pie charts it's able to query data but not rendering the chart. Would we be supporting other visualizations in future ?

@Bargs
Copy link
Contributor

Bargs commented Apr 4, 2017

@karthikbaputj top hits should work on pie charts. Could you please open a new ticket with details about the issue you're seeing?

@jbgi
Copy link

jbgi commented Jul 26, 2017

@Bargs it looks like top_hits on non-number fields only works for table and metric (hard-coded!!) :

if (vis.type.name === 'table' || vis.type.name === 'metric') {

Would be nice to allows other visualization plugins to use it...

@Bargs
Copy link
Contributor

Bargs commented Jul 27, 2017

@jbgi I agree, it would be nice if each vis could tell top_hits what type of data it supports. Feel free to create a new ticket with more info about your use case and we might be able to figure something out.

@slavik57
Copy link

slavik57 commented Sep 10, 2017

I created a visualization using the demo Kibana app to show the last status for ports:

  • I used the table visualization
    • Metric:
      • Aggregation: Top Hit
      • Field: status
      • Aggregate With: Concatenate
      • Size: 1
      • Sort On: @timestamp
      • Order: Descending
    • Split Rows:
      • Aggregation: Terms
      • Field: port
      • Order By: Term

The only thing that I'm missing is to sort the results by the status in case I have a lot of ports and I'm just showing the top 10 results in which case I might miss the errors. But if I show all the ports there is no problem

@Sjaak01
Copy link

Sjaak01 commented Jan 24, 2018

Came here searching for a way to do this and rather shocked that over 4 years later something basic as this still doesn't appear to be possible without jumping through many many hoops.

@Bargs
Copy link
Contributor

Bargs commented Jan 24, 2018

@Sjaak01 what do you need to do that the Top Hit metric does not provide?

@yehosef
Copy link

yehosef commented Jan 24, 2018

I think the issue is that you have to do some extra steps each time:

  • Aggregation: Top Hit
  • Field: status
  • Aggregate With: Concatenate
  • Size: 1
  • Sort On: @timestamp
  • Order: Descending

When you could just have

  • Aggregation: Last Value
  • Field: status

For a common use case, it's nice to have "short-hand" or helper widgets so I can use it in the simple way I think about it. I just know that I want the last value, instead of "I want the last value so I have to use one of the aggs to get it, and I have to set some options, so it's the right value, etc."

Additionally, if you then wanted to rewrite it at some point to use a simple query instead of aggregation, it wouldn't affect the user experience - they just want the "Last Value".

@Bargs
Copy link
Contributor

Bargs commented Jan 24, 2018

@yehosef after you select Top Hit, the only value you have to specify is "Field". Once you select your field, "aggregate with", "size", "sort on", and "order" all get set to sensible defaults automatically. So I don't see how the current Top Hit metric is any more burdensome than your proposed "Last Value" shorthand. If the issue is with the form simply being too complex for 90% of use cases, we could consider hiding some of the options in the "Advanced" drop down.

@yehosef
Copy link

yehosef commented Jan 24, 2018 via email

@Bargs
Copy link
Contributor

Bargs commented Jan 24, 2018

@yehosef I'd recommend creating a new Github issue so the team that works on Visualize can consider it. This sounds like an enhancement request to me, and it won't get much attention buried in this closed issue.

@yehosef
Copy link

yehosef commented Jan 24, 2018 via email

@Sjaak01
Copy link

Sjaak01 commented Mar 13, 2018

@Bargs It doesn't work on most fields for some reason.

I got various string fields with a text and keyword mapping and for some reason only one of them works (both text and keyword) but some other fields I have, also with a text and keyword mapping, don't display. The fields that don't display work fine in other visualizations. Of course there is data for the time range.

However as somebody else mentioned earlier in some cases you also want to only show the last value, regardless of the time range so even if this would work, it isn't a complete solution.

image

Not showing anything.
image

edit: tried with a different index and that seems to be working fine (different data but various field types, all work). Could this be some kind of bug?

@Bargs
Copy link
Contributor

Bargs commented Mar 13, 2018

@Sjaak01 I would open a separate issue for your field problems with top hits so the vis team can investigate

@sgpinkus
Copy link

sgpinkus commented Apr 5, 2021

@Sjaak01, @Bargs same issue here. Is it missing/null values? Seem a lot like #7189. Can't see how you deal with that from reading above discussion. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests