-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make dates be ReadableDateTimes in scripts #22948
Conversation
Instead of longs.
@rjernst, would you like to look at this? It is the second step we discussed in #22875 (comment). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// that scripts return the same internal representation as regular fields, so boolean | ||
// values in scripts need to be converted to a number, and the value formatter will | ||
// make sure of using true/false in the key_as_string field | ||
return ((Boolean) o).booleanValue() ? 1.0 : 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a bonus fix, unrelated to the date change right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed - bonus to make this line up with toLongValue
.
|
||
==== Date fields now return dates | ||
|
||
`doc.some_date_field.value` now returns `ReadableDateTime`s instead of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to link ReadableDateTime
here to the generated painless docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this conversation I don't think we're done here but I still think this is a step in the right direction so I'm going to retest locally and merge.
// that scripts return the same internal representation as regular fields, so boolean | ||
// values in scripts need to be converted to a number, and the value formatter will | ||
// make sure of using true/false in the key_as_string field | ||
return ((Boolean) o).booleanValue() ? 1.0 : 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed - bonus to make this line up with toLongValue
.
|
||
==== Date fields now return dates | ||
|
||
`doc.some_date_field.value` now returns `ReadableDateTime`s instead of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
master: 0d6e622 |
Instead of longs. If you want millis since epoch you can call
doc.date_field.value.millis
.Relates to #22875