Skip to content

Commit 277ccd9

Browse files
author
Christoph Büscher
committed
[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 dadc717 commit 277ccd9

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
@@ -212,13 +212,11 @@ POST hockey/player/1/_update
212212
==== Dates
213213

214214
Date fields are exposed as
215-
`ReadableDateTime` or
216-
so they support methods like
217-
`getYear`,
218-
and `getDayOfWeek`.
219-
To get milliseconds since epoch call
220-
`getMillis`.
221-
For example, the following returns every hockey player's birth year:
215+
`ReadableDateTime`, so they support methods like `getYear`, `getDayOfWeek`
216+
or e.g. getting milliseconds since epoch with `getMillis`. To use these
217+
in a script, leave out the `get` prefix and continue with lowercasing the
218+
rest of the method name. For example, the following returns every hockey
219+
player's birth year:
222220

223221
[source,js]
224222
----------------------------------------------------------------

0 commit comments

Comments
 (0)