From d007255e8f02645b1c77f0c933897088606a2362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Thu, 29 Oct 2020 16:58:19 +0100 Subject: [PATCH] [DOCS] Fixes typos in Transform Painless examples. (#64352) (#64358) --- docs/reference/transform/painless-examples.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/transform/painless-examples.asciidoc b/docs/reference/transform/painless-examples.asciidoc index a893e41d891..a42337cd9f5 100644 --- a/docs/reference/transform/painless-examples.asciidoc +++ b/docs/reference/transform/painless-examples.asciidoc @@ -26,7 +26,7 @@ aggregations, too. == Getting top hits by using scripted metric aggregation This snippet shows how to find the latest document, in other words the document -with the earliest timestamp. From a technical perspective, it helps to achieve +with the latest timestamp. From a technical perspective, it helps to achieve the function of a <> by using scripted metric aggregation in a {transform}, which provides a metric output. @@ -82,7 +82,7 @@ You can retrieve the last value in a similar way: "scripted_metric": { "init_script": "state.timestamp_latest = 0L; state.last_value = ''", "map_script": """ - def current_date = doc['date'].getValue().toInstant().toEpochMilli(); + def current_date = doc['@timestamp'].getValue().toInstant().toEpochMilli(); if (current_date > state.timestamp_latest) {state.timestamp_latest = current_date; state.last_value = params['_source']['value'];}