Skip to content

Conversation

williamrandolph
Copy link
Contributor

While working on a Machine Learning PR, @benwtrent noticed that certain bulk requests didn't work with system indices. Specifically, if we submitted a bulk request adding a document to an index that matched a system index pattern, did not yet exist, and didn't have the same name as the "primary index" for the system index descriptor, the request would fail. It turns out that we simply hadn't handled this case in #65970, apparently as an oversight. (In most or all other cases, the primary index is the only writeable index for a system index pattern.)

This PR fixes the bug and allows our code to autocreate non-primary system indices.

@williamrandolph williamrandolph marked this pull request as ready for review August 31, 2021 15:28
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Aug 31, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Contributor

@gwbrown gwbrown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple minor comments but otherwise LGTM. Thanks!

@williamrandolph williamrandolph merged commit e04e5eb into elastic:master Sep 2, 2021
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
7.x Commit could not be cherrypicked due to conflicts

To backport manually run backport --upstream elastic/elasticsearch --pr 77045

williamrandolph added a commit that referenced this pull request Sep 2, 2021
Previously, we handled the case of a write request to a system index
alias without a backing index by auto-creating the primary index. This
had the unfortunate side-effect of making it impossible to auto-create
non-primary system indices. This commit fixes the bug so that we can
handle both cases.

* Add internal cluster test for system index auto create
* Allow auto-creation of non-primary indices for a system index pattern
* Use primary index if autocreate is called with system index alias name
@williamrandolph
Copy link
Contributor Author

williamrandolph commented Sep 2, 2021

Backport commits
7.x - 83355d3
7.15 - 40a9a1b

williamrandolph added a commit that referenced this pull request Sep 2, 2021
Previously, we handled the case of a write request to a system index
alias without a backing index by auto-creating the primary index. This
had the unfortunate side-effect of making it impossible to auto-create
non-primary system indices. This commit fixes the bug so that we can
handle both cases.

* Add internal cluster test for system index auto create
* Allow auto-creation of non-primary indices for a system index pattern
* Use primary index if autocreate is called with system index alias name
@williamrandolph williamrandolph deleted the system-indices-autocreate-non-primary-index branch May 23, 2022 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team v7.15.1 v7.16.0 v8.0.0-alpha2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants