2323import org .elasticsearch .action .support .HandledTransportAction ;
2424import org .elasticsearch .action .support .RefCountingRunnable ;
2525import org .elasticsearch .client .internal .RemoteClusterClient ;
26- import org .elasticsearch .cluster .ClusterState ;
2726import org .elasticsearch .cluster .ProjectState ;
2827import org .elasticsearch .cluster .block .ClusterBlockLevel ;
2928import org .elasticsearch .cluster .metadata .IndexNameExpressionResolver ;
@@ -150,7 +149,7 @@ private void doExecuteForked(
150149 final CancellableTask fieldCapTask = (CancellableTask ) task ;
151150 // retrieve the initial timestamp in case the action is a cross cluster search
152151 long nowInMillis = request .nowInMillis () == null ? System .currentTimeMillis () : request .nowInMillis ();
153- final ClusterState clusterState = clusterService .state ();
152+ final ProjectState projectState = projectResolver . getProjectState ( clusterService .state () );
154153 final Map <String , OriginalIndices > remoteClusterIndices = transportService .getRemoteClusterService ()
155154 .groupIndices (request .indicesOptions (), request .indices ());
156155 final OriginalIndices localIndices = remoteClusterIndices .remove (RemoteClusterAware .LOCAL_CLUSTER_GROUP_KEY );
@@ -159,15 +158,15 @@ private void doExecuteForked(
159158 // in the case we have one or more remote indices but no local we don't expand to all local indices and just do remote indices
160159 concreteIndices = Strings .EMPTY_ARRAY ;
161160 } else {
162- concreteIndices = indexNameExpressionResolver .concreteIndexNames (clusterState , localIndices );
161+ concreteIndices = indexNameExpressionResolver .concreteIndexNames (projectState . metadata () , localIndices );
163162 }
164163
165164 if (concreteIndices .length == 0 && remoteClusterIndices .isEmpty ()) {
166165 listener .onResponse (new FieldCapabilitiesResponse (new String [0 ], Collections .emptyMap ()));
167166 return ;
168167 }
169168
170- checkIndexBlocks (projectResolver . getProjectState ( clusterState ) , concreteIndices );
169+ checkIndexBlocks (projectState , concreteIndices );
171170 final FailureCollector indexFailures = new FailureCollector ();
172171 final Map <String , FieldCapabilitiesIndexResponse > indexResponses = Collections .synchronizedMap (new HashMap <>());
173172 // This map is used to share the index response for indices which have the same index mapping hash to reduce the memory usage.
0 commit comments