Skip to content

Commit 6f3b333

Browse files
author
Christoph Büscher
authored
[Docs] Clarify accessing Date methods in painless (#33560)
The documentation currently tells users to use `doc['event_date'].value.getMillis` to access milliseconds in a date. It turns out the way it works is `doc['event_date'].value.millis`. This change corrects this and gives a hint at how other date related methods work.
1 parent a3e8b83 commit 6f3b333

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

docs/painless/painless-getting-started.asciidoc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,11 @@ POST hockey/player/1/_update
198198
==== Dates
199199

200200
Date fields are exposed as
201-
`ReadableDateTime` or
202-
so they support methods like
203-
`getYear`,
204-
and `getDayOfWeek`.
205-
To get milliseconds since epoch call
206-
`getMillis`.
207-
For example, the following returns every hockey player's birth year:
201+
`ReadableDateTime`, so they support methods like `getYear`, `getDayOfWeek`
202+
or e.g. getting milliseconds since epoch with `getMillis`. To use these
203+
in a script, leave out the `get` prefix and continue with lowercasing the
204+
rest of the method name. For example, the following returns every hockey
205+
player's birth year:
208206

209207
[source,js]
210208
----------------------------------------------------------------

0 commit comments

Comments
 (0)