Skip to content
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

Use a scripted reindex for re-writing document _ids for shared saved object types #107740

Closed
1 of 6 tasks
joshdover opened this issue Aug 5, 2021 · 4 comments
Closed
1 of 6 tasks
Labels
Feature:Migrations Feature:Saved Objects performance project:ResilientSavedObjectMigrations Reduce Kibana upgrade failures by making saved object migrations more resilient Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@joshdover
Copy link
Contributor

joshdover commented Aug 5, 2021

In #86247, we decided to go with a client-side reindex to support the shared saved object type migration which requires re-writing document _ids.

If we decide to stop handling unknown saved object types (see #107678), we may be able to change this to be a scripted reindex in Elasticsearch instead to increase performance of this migration. This would help users upgrade large Kibana installations to 8.0+ by reducing the amount of downtime. It'd also help with decreasing the complexity of the v2 migration algo.

Long-term this is likely an improvement we are going to need. There have been several cases now where plugins have written 100k+ or even 1M+ documents into the .kibana index (eg. #106308, #95321). Ideally, the v2 algo could handle such cases without manual intervention while we make sure to prevent the situation from happening in the first place. We should be able to implement later in the 8.x release to benefit customers who upgrade to the next major version later in the release lifecycle.

Open questions:

Blockers:

cc @jportner

@joshdover joshdover added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc performance Feature:Saved Objects project:ResilientSavedObjectMigrations Reduce Kibana upgrade failures by making saved object migrations more resilient Feature:Migrations labels Aug 5, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@joshdover joshdover changed the title Use a scripted reindex to for re-writing document _ids for shared saved object types Use a scripted reindex for re-writing document _ids for shared saved object types Aug 5, 2021
@jportner
Copy link
Contributor

jportner commented Aug 5, 2021

I have two comments/concerns:

Legacy URL aliases

When a namespaceType conversion causes an object ID to change, Kibana also creates a legacy URL alias object for it with its old ID and a few other fields. Effectively this creates two documents from one. It's not clear to me if this is possible during a scripted migration.

User-defined migrations

FWIW, the current implementation does technically allow user-defined migrations to change object types and/or IDs if necessary. It sounds like switching to a scripted reindex would preclude that.

We don't have anyone writing these types of migrations yet but I have seen some examples where the idea is being toyed with.

@rudolf
Copy link
Contributor

rudolf commented Aug 9, 2021

Once all saved object types have been converted the need for conversion effectively falls away, so from that point forward we could go back to using a reindex operation instead of the client-side reindex. E.g. if we convert all saved object types in 8.1 then 8.1 -> 8.2 can use a reindex, but 8.0 -> 8.2 would still use the client-side reindex. In a semver world we could remove the client-side reindex in 9.0.0, but most users could potentially benefit from better performance before that.

@pgayvallet
Copy link
Contributor

pgayvallet commented Oct 31, 2023

Given that the _id rewrite was a one time thing, and knowing we're now only updating (reindexing) the outdated documents without performing a full index reindex, I think it should be fine to close this. Feel free to reopen otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Migrations Feature:Saved Objects performance project:ResilientSavedObjectMigrations Reduce Kibana upgrade failures by making saved object migrations more resilient Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

5 participants