{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/kibana/issues/7302","repository_url":"https://api.github.com/repos/elastic/kibana","labels_url":"https://api.github.com/repos/elastic/kibana/issues/7302/labels{/name}","comments_url":"https://api.github.com/repos/elastic/kibana/issues/7302/comments","events_url":"https://api.github.com/repos/elastic/kibana/issues/7302/events","html_url":"https://github.com/elastic/kibana/pull/7302","id":157094927,"number":7302,"title":"add top_hit metric","user":{"login":"scampi","id":795879,"avatar_url":"https://avatars.githubusercontent.com/u/795879?v=3","gravatar_id":"","url":"https://api.github.com/users/scampi","html_url":"https://github.com/scampi","followers_url":"https://api.github.com/users/scampi/followers","following_url":"https://api.github.com/users/scampi/following{/other_user}","gists_url":"https://api.github.com/users/scampi/gists{/gist_id}","starred_url":"https://api.github.com/users/scampi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scampi/subscriptions","organizations_url":"https://api.github.com/users/scampi/orgs","repos_url":"https://api.github.com/users/scampi/repos","events_url":"https://api.github.com/users/scampi/events{/privacy}","received_events_url":"https://api.github.com/users/scampi/received_events","type":"User","site_admin":false},"labels":[{"id":478071923,"url":"https://api.github.com/repos/elastic/kibana/labels/:Aggregations","name":":Aggregations","color":"fbca04","default":false},{"id":462161355,"url":"https://api.github.com/repos/elastic/kibana/labels/:Visualizations","name":":Visualizations","color":"fef2c0","default":false},{"id":26198236,"url":"https://api.github.com/repos/elastic/kibana/labels/enhancement","name":"enhancement","color":"009800","default":true},{"id":135307740,"url":"https://api.github.com/repos/elastic/kibana/labels/review","name":"review","color":"eb6420","default":false}],"state":"closed","locked":false,"assignee":{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false},"assignees":[{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false},{"login":"ppisljar","id":13629809,"avatar_url":"https://avatars.githubusercontent.com/u/13629809?v=3","gravatar_id":"","url":"https://api.github.com/users/ppisljar","html_url":"https://github.com/ppisljar","followers_url":"https://api.github.com/users/ppisljar/followers","following_url":"https://api.github.com/users/ppisljar/following{/other_user}","gists_url":"https://api.github.com/users/ppisljar/gists{/gist_id}","starred_url":"https://api.github.com/users/ppisljar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppisljar/subscriptions","organizations_url":"https://api.github.com/users/ppisljar/orgs","repos_url":"https://api.github.com/users/ppisljar/repos","events_url":"https://api.github.com/users/ppisljar/events{/privacy}","received_events_url":"https://api.github.com/users/ppisljar/received_events","type":"User","site_admin":false}],"milestone":null,"comments":114,"created_at":"2016-05-26T22:41:47Z","updated_at":"2017-01-04T21:48:12Z","closed_at":"2017-01-04T21:47:28Z","pull_request":{"url":"https://api.github.com/repos/elastic/kibana/pulls/7302","html_url":"https://github.com/elastic/kibana/pull/7302","diff_url":"https://github.com/elastic/kibana/pull/7302.diff","patch_url":"https://github.com/elastic/kibana/pull/7302.patch"},"body":"close #6877 \r\n\r\nDisplay the first/last value of a field, for a set of documents sorted on some field (e.g., a date).\r\n\r\n# TODO\r\n\r\n- [x] aggregation of multivalued field\r\n- [x] object in array use case\r\n- [x] use `AggConfigResult.toString` for displaying arrays in the metric vis\r\n\r\n# Test\r\n## Index\r\n\r\nCreate the `weather` index with the following mapping:\r\n\r\n``` sh\r\n$ curl -XPUT 'http://localhost:9200/weather' -d '\r\n{\r\n   \"mappings\": {\r\n      \"Weather\": {\r\n         \"properties\": {\r\n            \"timestamp\": {\r\n               \"type\": \"date\",\r\n               \"format\": \"date_optional_time\"\r\n            },\r\n            \"location\": {\r\n               \"index\": \"not_analyzed\",\r\n               \"type\": \"string\"\r\n            }\r\n         }\r\n      }\r\n   }\r\n}\r\n'\r\n```\r\n## Data\r\n\r\nAdd a document at a time.\r\n\r\n``` sh\r\n$ curl -XPOST 'http://localhost:9200/weather/Weather/' -d '\r\n{\r\n  \"location\": \"France\",\r\n  \"temperature\": 28,\r\n  \"timestamp\": \"2016-05-26T21:22:18+01:00\"\r\n}\r\n'\r\n$ curl -XPOST 'http://localhost:9200/weather/Weather/' -d '\r\n{\r\n  \"location\": \"France\",\r\n  \"temperature\": 23.5,\r\n  \"timestamp\": \"2016-05-26T22:59:04+01:00\"\r\n}\r\n'\r\n```\r\n## Visualization\r\n\r\nWe can see what is the latest recorded temperature in France by doing the following:\r\n\r\nCreate either a `vertical bar` or a `data table`:\r\n- add a `Latest` metric:\r\n  - \"Field\": the field which value to display, here `temperature`\r\n  - \"Sort On\": the field to sort the data on, here `timestamp`\r\n- add a `terms` bucket on the field `location`.\r\n"},"comment":{"url":"https://api.github.com/repos/elastic/kibana/issues/comments/270496557","html_url":"https://github.com/elastic/kibana/pull/7302#issuecomment-270496557","issue_url":"https://api.github.com/repos/elastic/kibana/issues/7302","id":270496557,"user":{"login":"ppisljar","id":13629809,"avatar_url":"https://avatars.githubusercontent.com/u/13629809?v=3","gravatar_id":"","url":"https://api.github.com/users/ppisljar","html_url":"https://github.com/ppisljar","followers_url":"https://api.github.com/users/ppisljar/followers","following_url":"https://api.github.com/users/ppisljar/following{/other_user}","gists_url":"https://api.github.com/users/ppisljar/gists{/gist_id}","starred_url":"https://api.github.com/users/ppisljar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppisljar/subscriptions","organizations_url":"https://api.github.com/users/ppisljar/orgs","repos_url":"https://api.github.com/users/ppisljar/repos","events_url":"https://api.github.com/users/ppisljar/events{/privacy}","received_events_url":"https://api.github.com/users/ppisljar/received_events","type":"User","site_admin":false},"created_at":"2017-01-04T21:48:12Z","updated_at":"2017-01-04T21:48:12Z","body":"congrats scampi, this is a great PR and i am sure many are excited about finally having top hits in kibana!"}}
{"actor":{"display_login":"ppisljar"}}