Skip to content

Commit 3b6522b

Browse files
committed
Update predicate to skip ignored indices
1 parent a0c27bb commit 3b6522b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/deprecation/DeprecatedIndexPredicate.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,24 @@ public static Predicate<Index> getReindexRequiredPredicate(Metadata metadata) {
3333
}
3434

3535
public static boolean reindexRequired(IndexMetadata indexMetadata) {
36-
return creationVersionBeforeMinimumWritableVersion(indexMetadata) && isNotSearchableSnapshot(indexMetadata);
36+
return creationVersionBeforeMinimumWritableVersion(indexMetadata)
37+
&& isNotSearchableSnapshot(indexMetadata)
38+
&& isNotIgnored(indexMetadata);
39+
}
40+
41+
private static boolean creationVersionBeforeMinimumWritableVersion(IndexMetadata metadata) {
42+
return metadata.getCreationVersion().before(MINIMUM_WRITEABLE_VERSION_AFTER_UPGRADE);
3743
}
3844

3945
private static boolean isNotSearchableSnapshot(IndexMetadata indexMetadata) {
4046
return indexMetadata.isSearchableSnapshot() == false;
4147
}
4248

43-
private static boolean creationVersionBeforeMinimumWritableVersion(IndexMetadata metadata) {
44-
return metadata.getCreationVersion().before(MINIMUM_WRITEABLE_VERSION_AFTER_UPGRADE);
49+
private static boolean isNotIgnored(IndexMetadata indexMetadata) {
50+
IndexVersion ignoreVersion = indexMetadata.getSettings()
51+
.getAsVersionId(IndexMetadata.INDEX_IGNORE_DEPRECATION_WARNING_FOR_VERSION_KEY, IndexVersion::fromId);
52+
53+
return ignoreVersion == null || ignoreVersion.before(MINIMUM_WRITEABLE_VERSION_AFTER_UPGRADE);
4554
}
4655

4756
}

0 commit comments

Comments
 (0)