Created
December 4, 2015 23:40
-
-
Save wrobstory/595e2d2eeb39caa9dcad to your computer and use it in GitHub Desktop.
ES Window fn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:correlation_id 12345 :_id "abcde" :when_recorded "2015-01-01"} | |
{:correlation_id 12345 :_id "fjhij" :when_recorded "2015-01-02"} | |
{:correlation_id 12345 :_id "klmno" :when_recorded "2015-01-03"} | |
{:correlation_id 12345 :_id "pqrst" :when_recorded "2015-01-04"} | |
{:correlation_id 12345 :_id "uvwxy" :when_recorded "2015-01-05"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:ordered_docs {:terms {:field "correlation_id" | |
:order {:max_date "desc"} | |
:size 500} | |
:aggs {:most_recent_doc {:top_hits {:sort [{"when_recorded" {"order" "desc"}}] | |
:track_scores true | |
:size 1}} | |
:max_date {:max {:field "when_recorded"}}}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment