-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Aggregations: deprecate pre_zone
and post_zone
in date_histogram
#9722
Conversation
@jpountz Some very small addendum to the clean up of the |
@@ -10,3 +10,7 @@ your application from Elasticsearch 1.x to Elasticsearch 1.5. | |||
The `date_histogram` aggregation now support a simplified `offset` option that replaces the previous `pre_offset` and | |||
`post_offset` which are deprecated in 1.5. Instead of having to specify two separate offset shifts of the underlying buckets, the `offset` option | |||
moves the bucket boundaries in positive or negative direction depending on its argument. | |||
|
|||
Also for the `date_histogram`, options for `pre_zone` and `post_zone` options and the `pre_zone_adjust_large_interval` parameter |
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.
Either remove "the" before date_histogram, or add "aggregation" after.
@cbuescher A couple minor grammar comments. Also, shouldn't the documentation for |
Thanks for the comments, changed the migration notes and added a deprecation note in the docs. However I'm not entirely sure how these kind of changes are normally handled in the docs. Since the options are still valid I thought it best to keep the old docs unchanged, so I only added a warning at the end. |
@cbuescher I think the deprecation warning should happen where the parameters are introduced. Unfortunately the docs there right now are very mixed together. Perhaps move the note to the beginning of the section on timezone, and slim the message down to something like "Only use |
+1 to @rjernst 's suggestion. |
i just realized there is not much space in these deprecated[x.x.x, ...] sections, otherwise the layout seems to break (at least when I build the docs locally). Thats why I added two sections. Do you know of any better way to add a longer deprecation section to the docs to guide the user how to deal with the proposed changes? |
@cbuescher maybe you can use sections notifications as described here: https://github.com/elasticsearch/docs#section-notifications ? |
Will do. Also I forgot to mark the pre/postZone methods in the Builder as deprecated, will push those changes also in a sec. |
Tried using the section deprecation notes as suggested but this to me looked weired, just printed a warning below the section title. Without rewriting the documentation text this looks like the whole feature is deprecated. I split the notification into two now, added them above the relevant sections in the current text. |
@@ -46,6 +46,12 @@ | |||
static final ParseField OFFSET = new ParseField("offset"); | |||
static final ParseField PRE_OFFSET = new ParseField("", "pre_offset"); | |||
static final ParseField POST_OFFSET = new ParseField("", "post_offset"); | |||
static final ParseField PRE_ZONE = new ParseField("", "pre_zone"); | |||
static final ParseField POST_ZONE = new ParseField("", "post_zone"); |
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.
should we use ParseField.withAllDeprecated(String) here? That seems to be the way to specify that a field is completely deprecated. I think having the preferredName as ""
might cause issues?
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.
You mean like new ParseField("pre_zone").withAllDeprecated("")
? Since the argument of withAllDeprecated seems to replace the original names this would have to be empty. As long as having the deprecated name as preferedName still raises the desired exception, that would work, 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.
I could be wrong but it looks like the argument to withAllDeprecated indicates the new setting which has replaced the deprecated options and is only used in the error message to point the user to the new option. so for pre_zone
we would use new ParseField("pre_zone").withAllDeprecated("time_zone")
. It might be worth checking with @s1monw that this is indeed how it should work
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.
Yes, for that case makes sense. But for options like in the above case post_zone
which is dropped entirely, wouldn't then be empty argument to withAllDeprecated() be the right thing? Since there is no other option replacing it.
pre_zone
and post_zone
in date_histogram
pre_zone
and post_zone
in date_histogram
Changed the usage of ParseField for the deprecated fields. "pre_offset" and "post_offset" now point to "offset", "pre_zone" and "post_zone" to "time_zone" as new field name when strict parsing is enforced with an exception message like For the "pre_zone_adjust_large_interval" I used empty name for the deprecation name, since this option is completely going to be removed. This leads to exception messages like |
LGTM. This is good enough for me. |
@jpountz thanks, will push this then. |
Pushed to 1.x branch with 4505aba. |
@cbuescher would you mind taking a look at elastic/kibana#3566? We were previously using |
The options for
pre_zone
andpost_zone
indate_histogram
are going to be removed in 2.0 (see #9062) in favor of the already existingtime_zone
option. This commit deprecates those fields using ParseFields and adds deprecation notice to the migration guide.