-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Format support for script doc fields #60465
Format support for script doc fields #60465
Conversation
Adds `format` and `locale` support to `runtime_script` fields, specifically those with the `runtime_type` of `date`. Others `runtime_type`s will return an error if provided with those parameters.
Pinging @elastic/es-search (:Search/Search) |
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.
left a couple of comments, LGTM otherwise
MapperParsingException.class, | ||
() -> createIndex("test", Settings.EMPTY, mapping(runtimeType, b -> b.field("format", "yyyy-MM-dd"))) | ||
); | ||
assertThat(e.getMessage(), equalTo("Failed to parse mapping: format not supported by runtime_type [" + runtimeType + "]")); |
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.
nit: I think that looking at this error message, there is a slight change that it makes users think that the specific value they provided for the format parameter is not supported, more than providing any format. same for locale. Maybe we can rephrase it?
private void checkBadDate(ThrowingRunnable queryBuilder) { | ||
Exception e = expectThrows(ElasticsearchParseException.class, queryBuilder); | ||
assertThat(e.getMessage(), containsString("failed to parse date field")); | ||
} |
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.
would it make sense to have some duel tests between concrete dates and runtime dates to make sure that formatting and locale are applied the same way?
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.
Yeah!
Adds
format
andlocale
support toruntime_script
fields,specifically those with the
runtime_type
ofdate
. Othersruntime_type
s will return an error if provided with those parameters.Relates to #59332