-
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
[ML] Add indices_options to datafeed config and update #52793
[ML] Add indices_options to datafeed config and update #52793
Conversation
Pinging @elastic/ml-core (:ml) |
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.
Looks good! My only confusion has to do with handling default options when it is not set. In particular, it seems we used to have 2 different defaults in different places: IndicesOptions.lenientExpandOpen() and SearchRequest.DEFAULT_INDICES_OPTIONS, which is IndicesOptions.strictExpandOpenAndForbidClosedIgnoreThrottled().
With this change defaults will remain the same when there are no options set. But if a user sets options explicitly, we use SearchRequest.DEFAULT_INDICES_OPTIONS as the default options. This is the part that confuses me.
@@ -44,8 +46,15 @@ public String getName() { | |||
@Override | |||
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException { | |||
String datafeedId = restRequest.param(DatafeedConfig.ID.getPreferredName()); | |||
IndicesOptions indicesOptions = null; | |||
if (restRequest.hasParam("expand_wildcards") |
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.
Could we avoid checking if restRequest
has those params? I think it'd work to do IndicesOptions indicesOptions = IndicesOptions.fromRequest(restRequest, SearchRequest.DEFAULT_INDICES_OPTIONS)
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.
Makes sense. DatafeedConfig can make the options non-null and default to SearchRequestt.DEFAULT_INDICES_OPTIONS
@@ -44,8 +46,15 @@ public String getName() { | |||
@Override | |||
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException { | |||
String datafeedId = restRequest.param(DatafeedConfig.ID.getPreferredName()); | |||
IndicesOptions indicesOptions = null; | |||
if (restRequest.hasParam("expand_wildcards") |
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.
ditto
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 don't agree. If none are provided, then that means the user doesn't want to update them.
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.
Ah, yes. That's the update. My bad!
It seems that this was a bug before, and it didn't really matter in the days before frozen indices but frozen indices mean it could cause weird behaviour. We discussed this a bit in a different channel and the outcome was:
Currently that sets the same assignment failure reason as an exception from the indices options check sets, and this could lead to confusion if indices options include |
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.
LGTM
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.
LGTM2
This adds a new configurable field called `indices_options`. This allows users to create or update the indices_options used when a datafeed reads from an index. This is necessary for the following use cases: - Reading from frozen indices - Allowing certain indices in multiple index patterns to not exist yet These index options are available on datafeed creation and update. Users may specify them as URL parameters or within the configuration object. closes elastic#48056
This adds a new configurable field called `indices_options`. This allows users to create or update the indices_options used when a datafeed reads from an index. This is necessary for the following use cases: - Reading from frozen indices - Allowing certain indices in multiple index patterns to not exist yet These index options are available on datafeed creation and update. Users may specify them as URL parameters or within the configuration object. closes #48056
Re-enables bwc tests and fixes up code after backport of #52793
This adds a new configurable field called
indices_options
. This allows users to create or update the indices_options used when a datafeed reads from an index.This is necessary for the following use cases:
These index options are available on datafeed creation and update. Users may specify them as URL parameters or within the configuration object.
closes #48056