System index auto-creation should not be disabled by user settings#62984
Merged
williamrandolph merged 5 commits intoelastic:masterfrom Oct 1, 2020
Merged
Conversation
By default, Elasticsearch auto-creates indices when a document is submitted to a non-existent index. There is a setting that allows users to disable this behavior. However, this setting should not apply to system indices, so that Elasticsearch modules and plugins are able to use auto-create behavior whether or not it is exposed to users. This commit constructs the AutoCreateIndex object with a reference to the SystemIndices object so that we bypass the check for the user-facing autocreate setting when it's a system index that is being autocreated. We also modify the logic in TransportBulkAction to make sure that if a system index is included in a bulk request, we don't skip the autocreation step.
Collaborator
|
Pinging @elastic/es-core-infra (:Core/Infra/Core) |
AthenaEryma
reviewed
Sep 29, 2020
server/src/test/java/org/elasticsearch/action/support/AutoCreateIndexTests.java
Outdated
Show resolved
Hide resolved
| if (needToCheck()) { | ||
| final boolean includesSystem = includesSystem(bulkRequest, clusterService.state().metadata().getIndicesLookup(), systemIndices); | ||
|
|
||
| if (includesSystem || needToCheck()) { |
Contributor
There was a problem hiding this comment.
You've already noted in this in the PR description, but this is going to conflict with https://github.com/elastic/elasticsearch/pull/61858/files?file-filters%5B%5D=.java#diff-7c2a294c3d25c427072ee6c64983b560L227 specifically. I think this is the only place they'll meaningfully conflict, though.
server/src/test/java/org/elasticsearch/action/support/AutoCreateIndexTests.java
Show resolved
Hide resolved
AthenaEryma
approved these changes
Oct 1, 2020
Contributor
AthenaEryma
left a comment
There was a problem hiding this comment.
LGTM, thanks! As we discussed elsewhere, let's go ahead and merge this as it looks like #61858 might be a bit of a wait.
williamrandolph
added a commit
to williamrandolph/elasticsearch
that referenced
this pull request
Oct 1, 2020
…lastic#62984) * Add System Indices check to AutoCreateIndex By default, Elasticsearch auto-creates indices when a document is submitted to a non-existent index. There is a setting that allows users to disable this behavior. However, this setting should not apply to system indices, so that Elasticsearch modules and plugins are able to use auto-create behavior whether or not it is exposed to users. This commit constructs the AutoCreateIndex object with a reference to the SystemIndices object so that we bypass the check for the user-facing autocreate setting when it's a system index that is being autocreated. We also modify the logic in TransportBulkAction to make sure that if a system index is included in a bulk request, we don't skip the autocreation step.
williamrandolph
added a commit
that referenced
this pull request
Oct 1, 2020
…62984) (#63147) * Add System Indices check to AutoCreateIndex By default, Elasticsearch auto-creates indices when a document is submitted to a non-existent index. There is a setting that allows users to disable this behavior. However, this setting should not apply to system indices, so that Elasticsearch modules and plugins are able to use auto-create behavior whether or not it is exposed to users. This commit constructs the AutoCreateIndex object with a reference to the SystemIndices object so that we bypass the check for the user-facing autocreate setting when it's a system index that is being autocreated. We also modify the logic in TransportBulkAction to make sure that if a system index is included in a bulk request, we don't skip the autocreation step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By default, Elasticsearch auto-creates indices when a document is submitted to a non-existent index. There is a setting that allows users to disable this behavior. However, this setting should not apply to system indices, so that Elasticsearch modules and plugins are able to use auto-create behavior whether or not it is exposed to users.
This commit constructs the AutoCreateIndex object with a reference to the SystemIndices object so that we bypass the check for the user-facing autocreate setting when it's a system index that is being autocreated.
We also modify the logic in TransportBulkAction to make sure that if a system index is included in a bulk request, we don't skip the autocreation step.
Closes #61642
Note that this PR touches the same code as #61858, which should probably be merged first.
Todo: