Make dates be ReadableDateTimes in scripts#22948
Merged
nik9000 merged 2 commits intoelastic:masterfrom Feb 6, 2017
Merged
Conversation
Instead of longs.
Member
Author
|
@rjernst, would you like to look at this? It is the second step we discussed in #22875 (comment). |
rjernst
approved these changes
Feb 3, 2017
| // 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; |
Member
There was a problem hiding this comment.
This is just a bonus fix, unrelated to the date change right?
Member
Author
There was a problem hiding this comment.
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 |
Member
There was a problem hiding this comment.
Is it possible to link ReadableDateTime here to the generated painless docs?
nik9000
commented
Feb 6, 2017
Member
Author
nik9000
left a comment
There was a problem hiding this comment.
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; |
Member
Author
There was a problem hiding this comment.
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 |
Member
Author
|
master: 0d6e622 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of longs. If you want millis since epoch you can call
doc.date_field.value.millis.Relates to #22875