Skip to content

Commit

Permalink
[8.17] [UA] Ensure that old indices are detected for reindexing (#203082
Browse files Browse the repository at this point in the history
) (#203118)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[UA] Ensure that old indices are detected for reindexing
(#203082)](#203082)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jean-Louis
Leysens","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-05T14:47:32Z","message":"[UA]
Ensure that old indices are detected for reindexing (#203082)\n\n##
Summary\r\n\r\nWe need to handle the following response shape from
`GET\r\n_migration/deprecations`\r\n\r\n```jsonc\r\n \"myindex\": [\r\n
{\r\n \"level\": \"critical\",\r\n \"message\": \"Old index with a
compatibility version < 8.0\", // specifically this message\r\n \"url\":
\"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html\",\r\n
\"details\": \"This index has version: 7.17.25\",\r\n
\"resolve_during_rolling_upgrade\": false\r\n }\r\n ]\r\n```\r\n\r\n<img
width=\"1142\" alt=\"Screenshot 2024-12-05 at 12 44
59\"\r\nsrc=\"https://github.com/user-attachments/assets/723e19ab-dd9d-4b6a-bcda-26a5c8bffa0b\">\r\n\r\n\r\n##
To reviewers\r\n\r\nThese changes were developed/tested on `8.x` and
must be backported.\r\n\r\nRelated\r\n*
https://github.com/elastic/kibana/issues/202669\r\n*
https://github.com/elastic/elasticsearch/issues/118062","sha":"3579425d77caeb59bdb101a2f3c88fe111f8e65e","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","Feature:Upgrade
Assistant","v9.0.0","backport:version","v8.17.0","v8.18.0"],"title":"[UA]
Ensure that old indices are detected for
reindexing","number":203082,"url":"https://github.com/elastic/kibana/pull/203082","mergeCommit":{"message":"[UA]
Ensure that old indices are detected for reindexing (#203082)\n\n##
Summary\r\n\r\nWe need to handle the following response shape from
`GET\r\n_migration/deprecations`\r\n\r\n```jsonc\r\n \"myindex\": [\r\n
{\r\n \"level\": \"critical\",\r\n \"message\": \"Old index with a
compatibility version < 8.0\", // specifically this message\r\n \"url\":
\"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html\",\r\n
\"details\": \"This index has version: 7.17.25\",\r\n
\"resolve_during_rolling_upgrade\": false\r\n }\r\n ]\r\n```\r\n\r\n<img
width=\"1142\" alt=\"Screenshot 2024-12-05 at 12 44
59\"\r\nsrc=\"https://github.com/user-attachments/assets/723e19ab-dd9d-4b6a-bcda-26a5c8bffa0b\">\r\n\r\n\r\n##
To reviewers\r\n\r\nThese changes were developed/tested on `8.x` and
must be backported.\r\n\r\nRelated\r\n*
https://github.com/elastic/kibana/issues/202669\r\n*
https://github.com/elastic/elasticsearch/issues/118062","sha":"3579425d77caeb59bdb101a2f3c88fe111f8e65e"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203082","number":203082,"mergeCommit":{"message":"[UA]
Ensure that old indices are detected for reindexing (#203082)\n\n##
Summary\r\n\r\nWe need to handle the following response shape from
`GET\r\n_migration/deprecations`\r\n\r\n```jsonc\r\n \"myindex\": [\r\n
{\r\n \"level\": \"critical\",\r\n \"message\": \"Old index with a
compatibility version < 8.0\", // specifically this message\r\n \"url\":
\"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html\",\r\n
\"details\": \"This index has version: 7.17.25\",\r\n
\"resolve_during_rolling_upgrade\": false\r\n }\r\n ]\r\n```\r\n\r\n<img
width=\"1142\" alt=\"Screenshot 2024-12-05 at 12 44
59\"\r\nsrc=\"https://github.com/user-attachments/assets/723e19ab-dd9d-4b6a-bcda-26a5c8bffa0b\">\r\n\r\n\r\n##
To reviewers\r\n\r\nThese changes were developed/tested on `8.x` and
must be backported.\r\n\r\nRelated\r\n*
https://github.com/elastic/kibana/issues/202669\r\n*
https://github.com/elastic/elasticsearch/issues/118062","sha":"3579425d77caeb59bdb101a2f3c88fe111f8e65e"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Jean-Louis Leysens <[email protected]>
  • Loading branch information
kibanamachine and jloleysens authored Dec 5, 2024
1 parent b0bbb93 commit 07d6b3d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@
"details": "[[type: tweet, field: liked]]",
"resolve_during_rolling_upgrade": false
}
],
"myindex": [
{
"level": "critical",
"message": "Old index with a compatibility version < 8.0",
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html",
"details": "This index has version: 7.17.25",
"resolve_during_rolling_upgrade": false
}
]
},
"data_streams": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ type EsMetadata = Actions & {
[key: string]: string;
};

// TODO(jloleysens): Replace these regexes once this issue is addressed https://github.com/elastic/elasticsearch/issues/118062
const ES_INDEX_MESSAGES_REQIURING_REINDEX = [
/Index created before/,
/index with a compatibility version \</,
];

export const getCorrectiveAction = (
message: string,
metadata: EsMetadata,
Expand All @@ -31,7 +37,9 @@ export const getCorrectiveAction = (
const clusterSettingDeprecation = metadata?.actions?.find(
(action) => action.action_type === 'remove_settings' && typeof indexName === 'undefined'
);
const requiresReindexAction = /Index created before/.test(message);
const requiresReindexAction = ES_INDEX_MESSAGES_REQIURING_REINDEX.some((regexp) =>
regexp.test(message)
);
const requiresIndexSettingsAction = Boolean(indexSettingDeprecation);
const requiresClusterSettingsAction = Boolean(clusterSettingDeprecation);
const requiresMlAction = /[Mm]odel snapshot/.test(message);
Expand Down

0 comments on commit 07d6b3d

Please sign in to comment.