2222import org .elasticsearch .cluster .block .ClusterBlockLevel ;
2323import org .elasticsearch .cluster .metadata .IndexMetadata ;
2424import org .elasticsearch .cluster .metadata .LifecycleExecutionState ;
25- import org .elasticsearch .cluster .metadata .Metadata ;
25+ import org .elasticsearch .cluster .metadata .ProjectMetadata ;
2626import org .elasticsearch .cluster .service .ClusterService ;
2727import org .elasticsearch .cluster .service .MasterServiceTaskQueue ;
2828import org .elasticsearch .common .Priority ;
@@ -90,12 +90,12 @@ protected ClusterBlockException checkBlock(CopyLifecycleIndexMetadataAction.Requ
9090 }
9191
9292 private static ClusterState applyUpdate (ClusterState state , UpdateIndexMetadataTask updateTask ) {
93-
94- IndexMetadata sourceMetadata = state . metadata (). getProject () .index (updateTask .sourceIndex );
93+ final ProjectMetadata projectMetadata = state . metadata (). getProject ();
94+ IndexMetadata sourceMetadata = projectMetadata .index (updateTask .sourceIndex );
9595 if (sourceMetadata == null ) {
9696 throw new IndexNotFoundException (updateTask .sourceIndex );
9797 }
98- IndexMetadata destMetadata = state . metadata (). getProject () .index (updateTask .destIndex );
98+ IndexMetadata destMetadata = projectMetadata .index (updateTask .destIndex );
9999 if (destMetadata == null ) {
100100 throw new IndexNotFoundException (updateTask .destIndex );
101101 }
@@ -113,11 +113,11 @@ private static ClusterState applyUpdate(ClusterState state, UpdateIndexMetadataT
113113 // creation date updates settings so must increment settings version
114114 .settingsVersion (destMetadata .getSettingsVersion () + 1 );
115115
116- var indices = new HashMap <>(state . metadata (). getProject () .indices ());
116+ var indices = new HashMap <>(projectMetadata .indices ());
117117 indices .put (updateTask .destIndex , newDestMetadata .build ());
118118
119- Metadata newMetadata = Metadata .builder (state . metadata () ).indices (indices ).build ();
120- return ClusterState .builder (state ).metadata (newMetadata ).build ();
119+ ProjectMetadata newMetadata = ProjectMetadata .builder (projectMetadata ).indices (indices ).build ();
120+ return ClusterState .builder (state ).putProjectMetadata (newMetadata ).build ();
121121 }
122122
123123 static class UpdateIndexMetadataTask extends AckedBatchedClusterStateUpdateTask {
0 commit comments