Skip to content

Upgrade Assistant README reindexing steps are inaccurate #121237

Open

Description

The current README states that reindexing works like this:

  1. Create a new index with a "reindexed-" prefix (#30114).
  2. Create an index alias pointing from the original index name to the prefixed index name.
  3. Reindex from the original index into the prefixed index.
  4. Delete the old index and rename the prefixed index.

Per @yuliacech's comment at #120137 (comment), the correct steps are:

  1. Set index test_data to read-only using the index.blocks.write: true setting
  2. Create new index reindexed-v6.8-test_data
  3. Reindex documents from test_data to reindexed-v6.8-test_data
  4. Create alias test_data that points to reindexed-v6.8-test_data
  5. Delete index test_data

Whoever updates the README should read through https://github.com/elastic/kibana/blob/main/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts and verify what I've stated is correct.

While we're at it, we should also update this comment:

/**
* Sets the original index as readonly so new data can be indexed until the reindex
* is completed.
* @param reindexOp
*/
const setReadonly = async (reindexOp: ReindexSavedObject) => {
const { indexName } = reindexOp.attributes;
const { body: putReadonly } = await esClient.indices.putSettings({
index: indexName,
body: { blocks: { write: true } },
});
if (!putReadonly.acknowledged) {
throw new Error(`Index could not be set to readonly.`);
}
return actions.updateReindexOp(reindexOp, { lastCompletedStep: ReindexStep.readonly });
};

The comment states "so new data can be indexed", but that doesn't make sense because we're setting the index to be read-only. This might have just been a typo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions