-
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
support only string format for date, root object & date range #28117
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
1 similar comment
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
Pinging @elastic/es-search-aggs |
@nikoncode sorry for the delay on this, I just found this in unanswered PR while scanning issues. I will update the branch by merging in master if you don't mind and will take a first look then. |
Conflicts: core/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java core/src/test/java/org/elasticsearch/index/mapper/DateFieldMapperTests.java core/src/test/java/org/elasticsearch/index/mapper/RangeFieldMapperTests.java core/src/test/java/org/elasticsearch/index/mapper/RootObjectMapperTests.java
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.
@nikoncode thanks again for opening this, I think the PR looks quite good already but I left a suggestion for a change. Would you be interested in making this change? I understand that after waiting for quite some time you might not be interested in working on this any longer. Let me know if you want to pick it up or would like somebody else to work on it. I think its a good change to get in.
@@ -265,7 +265,10 @@ private static IndexOptions nodeIndexOptionValue(final Object propNode) { | |||
} | |||
|
|||
public static FormatDateTimeFormatter parseDateTimeFormatter(Object node) { | |||
return Joda.forPattern(node.toString()); | |||
if (node instanceof String) { |
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.
Instead of instance testing here I would suggest changing the method to only take a String argument (the format) and change all call sites to convert to String instead. I should be save to do so since we to it here anyway currently.
That way we also don't need to throw an exception for bad formats, Jodas "forPattern" will do so already.
@cbuescher I'll handle it and mention you again to review. |
@cbuescher I don't think that your suggestion is relevant. Problem of the original issue is using If I will implement your recommendation:
|
I see. I was trying to avoid adding the |
@elasticmachine test this please |
@nikoncode would you mind adding a bit more detail to the first comment, since this is what the final commit message will be based on? Otherwise I can also write a few lines, but I think its better if the commit author adds a few words. |
@nikoncode I took the liberty to merge in the current state of the master branch because CI was failing without it. Hope you don't mind. |
@cbuescher I have changed my message. |
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.
Still looking good. I will merge this in shortly
Limit date `format` attribute to String values only. Closes #23650
* master: Adjust BWC version on mapping version Token API supports the client_credentials grant (#33106) Build: forked compiler max memory matches jvmArgs (#33138) Introduce mapping version to index metadata (#33147) SQL: Enable aggregations to create a separate bucket for missing values (#32832) Fix grammar in contributing docs SECURITY: Fix Compile Error in ReservedRealmTests (#33166) APM server monitoring (#32515) Support only string `format` in date, root object & date range (#28117) [Rollup] Move toBuilders() methods out of rollup config objects (#32585) Fix forbiddenapis on java 11 (#33116) Apply publishing to genreate pom (#33094) Have circuit breaker succeed on unknown mem usage Do not lose default mapper on metadata updates (#33153) Fix a mappings update test (#33146) Reload Secure Settings REST specs & docs (#32990) Refactor CachingUsernamePassword realm (#32646)
* 6.x: Introduce mapping version to index metadata (#33147) Move non duplicated actions back into xpack core (#32952) HLRC: Create server agnostic request and response (#32912) Build: forked compiler max memory matches jvmArgs (#33138) * Added breaking change section for GROUP BY behavior: now it considers null or empty values as a separate group/bucket. Previously, they were ignored. * This is part of backporting of #32832 SQL: Enable aggregations to create a separate bucket for missing values (#32832) [TEST] version guard for reload rest-api-spec Fix grammar in contributing docs APM server monitoring (#32515) Support only string `format` in date, root object & date range (#28117) [Rollup] Move toBuilders() methods out of rollup config objects (#32585) Accept Gradle build scan agreement (#30645) Fix forbiddenapis on java 11 (#33116) Run forbidden api checks with runtimeJavaVersion (#32947) Apply publishing to genreate pom (#33094) Fix a mappings update test (#33146) Reload Secure Settings REST specs & docs (#32990) Refactor CachingUsernamePassword realm (#32646)
Limit date
format
attribute to String values only (to avoid serialization issues)Closes #23650