Kibana Query for Max Date?


Using Logstash I have JSON docs that gets stored into Elastic Search every minute with the most current timestamp, and with c1 being the count of rows returned by a SQL Query.

"c1" => 0,
"@version" => "1",
"@timestamp" => "2015-10-22T19:10:00.258Z",
"type" => "testuser1-counts",
"username" => "testuser1"

Using Kibana and the following Query string, i'm able to fetch all the JSON docs persisted into Elastic search associated with the type testuser1-counts.


However what Query string can I use in Kibana to fetch the one JSON doc with the latest timestamp, that way I have access to the latest c1 count?

Many thanks,

I'm quite new to Kibana and Lucene queries
Is what I described even possible? Anyone?


Kibana query string is based on Lucene query syntax, or you can also use the "filters" part of Elasticsearch Query DSL. Neither would give you the ability to run a function and determine a "max" value, for that you need aggregations. In Kibana 4, aggregations are exposed using the vis builder, so here is one way to display a max date.

Unfortunately, since at this time there is no way to filter for documents with max date, there is no way to display a value at max date. We are tracking an enhancement for that: