Skip to content

improve date api for expressions/painless fields#18658

Merged
rmuir merged 1 commit intoelastic:masterfrom
rmuir:jodaTime
May 31, 2016
Merged

improve date api for expressions/painless fields#18658
rmuir merged 1 commit intoelastic:masterfrom
rmuir:jodaTime

Conversation

@rmuir
Copy link
Copy Markdown
Contributor

@rmuir rmuir commented May 31, 2016

ScriptDocValues.Longs exposes a .date member that other scripting engines use to get convenient access to date components.

For example doc['field'].date.monthOfYear.

Expressions does this inconsistently, it supports a few (but not all) of these methods, but via a different syntax without the .date, and sometimes with different semantics (!) because it uses java.util.Calendar.

For expressions this pr adds .date working the same way/syntax is it does for other engines, and undocuments the old methods: the old methods are left unchanged for anything using them. For painless it adds ReadableDateTime to the whitelist so the same syntax works there too.

We can also fix a few other inconsistencies in expressions, like supporting .length/.size() for the count of values for the field to match other engines: this way its more of a proper subset for most uses.

@rjernst
Copy link
Copy Markdown
Member

rjernst commented May 31, 2016

LGTM

@jdconrad
Copy link
Copy Markdown
Contributor

LGTM also!

@jdconrad jdconrad mentioned this pull request May 31, 2016
18 tasks
@rmuir rmuir merged commit 0373c62 into elastic:master May 31, 2016
@clintongormley clintongormley added :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache and removed :Plugin Lang Painless labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement v5.0.0-alpha4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants