@@ -176,9 +176,9 @@ private AlreadyResolvedKey(final IndicesOptions indicesOptions, final boolean en
176
176
}
177
177
178
178
private AlreadyResolvedKey (
179
- final IndicesOptions indicesOptions ,
180
- final boolean enableCrossClusterResolution ,
181
- final String [] original
179
+ final IndicesOptions indicesOptions ,
180
+ final boolean enableCrossClusterResolution ,
181
+ final String [] original
182
182
) {
183
183
this .indicesOptions = indicesOptions ;
184
184
this .enableCrossClusterResolution = enableCrossClusterResolution ;
@@ -191,8 +191,8 @@ public boolean equals(Object o) {
191
191
if (o == null || getClass () != o .getClass ()) return false ;
192
192
AlreadyResolvedKey that = (AlreadyResolvedKey ) o ;
193
193
return enableCrossClusterResolution == that .enableCrossClusterResolution
194
- && Objects .equals (indicesOptions , that .indicesOptions )
195
- && Arrays .equals (original , that .original );
194
+ && Objects .equals (indicesOptions , that .indicesOptions )
195
+ && Arrays .equals (original , that .original );
196
196
}
197
197
198
198
@ Override
@@ -213,10 +213,10 @@ public int hashCode() {
213
213
}
214
214
215
215
private void resolveIndexPatterns (
216
- final String name ,
217
- final IndicesOptions indicesOptions ,
218
- final boolean enableCrossClusterResolution ,
219
- final String [] original
216
+ final String name ,
217
+ final IndicesOptions indicesOptions ,
218
+ final boolean enableCrossClusterResolution ,
219
+ final String [] original
220
220
) {
221
221
final boolean isTraceEnabled = log .isTraceEnabled ();
222
222
if (isTraceEnabled ) {
@@ -239,11 +239,11 @@ private void resolveIndexPatterns(
239
239
if (remoteClusterService .isCrossClusterSearchEnabled () && enableCrossClusterResolution ) {
240
240
remoteIndices = new HashSet <>();
241
241
final Map <String , OriginalIndices > remoteClusterIndices = OpenSearchSecurityPlugin .GuiceHolder .getRemoteClusterService ()
242
- .groupIndices (indicesOptions , original , idx -> resolver .hasIndexAbstraction (idx , clusterService .state ()));
242
+ .groupIndices (indicesOptions , original , idx -> resolver .hasIndexAbstraction (idx , clusterService .state ()));
243
243
final Set <String > remoteClusters = remoteClusterIndices .keySet ()
244
- .stream ()
245
- .filter (k -> !RemoteClusterService .LOCAL_CLUSTER_GROUP_KEY .equals (k ))
246
- .collect (Collectors .toSet ());
244
+ .stream ()
245
+ .filter (k -> !RemoteClusterService .LOCAL_CLUSTER_GROUP_KEY .equals (k ))
246
+ .collect (Collectors .toSet ());
247
247
for (String remoteCluster : remoteClusters ) {
248
248
for (String remoteIndex : remoteClusterIndices .get (remoteCluster ).indices ()) {
249
249
remoteIndices .add (RemoteClusterService .buildRemoteIndexName (remoteCluster , remoteIndex ));
@@ -261,10 +261,10 @@ private void resolveIndexPatterns(
261
261
262
262
if (isTraceEnabled ) {
263
263
log .trace (
264
- "CCS is enabled, we found this local patterns "
265
- + localRequestedPatterns
266
- + " and this remote patterns: "
267
- + remoteIndices
264
+ "CCS is enabled, we found this local patterns "
265
+ + localRequestedPatterns
266
+ + " and this remote patterns: "
267
+ + remoteIndices
268
268
);
269
269
}
270
270
@@ -294,31 +294,31 @@ private void resolveIndexPatterns(
294
294
else {
295
295
final ClusterState state = clusterService .state ();
296
296
final Set <String > dateResolvedLocalRequestedPatterns = localRequestedPatterns .stream ()
297
- .map (resolver ::resolveDateMathExpression )
298
- .collect (Collectors .toSet ());
297
+ .map (resolver ::resolveDateMathExpression )
298
+ .collect (Collectors .toSet ());
299
299
final WildcardMatcher dateResolvedMatcher = WildcardMatcher .from (dateResolvedLocalRequestedPatterns );
300
300
// fill matchingAliases
301
301
final Map <String , IndexAbstraction > lookup = state .metadata ().getIndicesLookup ();
302
302
matchingAliases = lookup .entrySet ()
303
- .stream ()
304
- .filter (e -> e .getValue ().getType () == ALIAS )
305
- .map (Map .Entry ::getKey )
306
- .filter (dateResolvedMatcher )
307
- .collect (Collectors .toSet ());
303
+ .stream ()
304
+ .filter (e -> e .getValue ().getType () == ALIAS )
305
+ .map (Map .Entry ::getKey )
306
+ .filter (dateResolvedMatcher )
307
+ .collect (Collectors .toSet ());
308
308
309
309
final boolean isDebugEnabled = log .isDebugEnabled ();
310
310
try {
311
311
matchingAllIndices = Arrays .asList (
312
- resolver .concreteIndexNames (state , indicesOptions , localRequestedPatterns .toArray (new String [0 ]))
312
+ resolver .concreteIndexNames (state , indicesOptions , localRequestedPatterns .toArray (new String [0 ]))
313
313
);
314
314
matchingDataStreams = resolver .dataStreamNames (state , indicesOptions , localRequestedPatterns .toArray (new String [0 ]));
315
315
316
316
if (isDebugEnabled ) {
317
317
log .debug (
318
- "Resolved pattern {} to indices: {} and data-streams: {}" ,
319
- localRequestedPatterns ,
320
- matchingAllIndices ,
321
- matchingDataStreams
318
+ "Resolved pattern {} to indices: {} and data-streams: {}" ,
319
+ localRequestedPatterns ,
320
+ matchingAllIndices ,
321
+ matchingDataStreams
322
322
);
323
323
}
324
324
} catch (IndexNotFoundException e1 ) {
@@ -336,15 +336,15 @@ private void resolveIndexPatterns(
336
336
337
337
if (isTraceEnabled ) {
338
338
log .trace (
339
- "Resolved patterns {} for {} ({}) to [aliases {}, allIndices {}, dataStreams {}, originalRequested{}, remote indices {}]" ,
340
- original ,
341
- name ,
342
- this .name ,
343
- matchingAliases ,
344
- matchingAllIndices ,
345
- matchingDataStreams ,
346
- Arrays .toString (original ),
347
- remoteIndices
339
+ "Resolved patterns {} for {} ({}) to [aliases {}, allIndices {}, dataStreams {}, originalRequested{}, remote indices {}]" ,
340
+ original ,
341
+ name ,
342
+ this .name ,
343
+ matchingAliases ,
344
+ matchingAllIndices ,
345
+ matchingDataStreams ,
346
+ Arrays .toString (original ),
347
+ remoteIndices
348
348
);
349
349
}
350
350
@@ -358,11 +358,11 @@ private void resolveToLocalAll() {
358
358
}
359
359
360
360
private void resolveTo (
361
- Iterable <String > matchingAliases ,
362
- Iterable <String > matchingAllIndices ,
363
- Iterable <String > matchingDataStreams ,
364
- String [] original ,
365
- Iterable <String > remoteIndices
361
+ Iterable <String > matchingAliases ,
362
+ Iterable <String > matchingAllIndices ,
363
+ Iterable <String > matchingDataStreams ,
364
+ String [] original ,
365
+ Iterable <String > remoteIndices
366
366
) {
367
367
aliases .addAll (matchingAliases );
368
368
allIndices .addAll (matchingAllIndices );
@@ -375,8 +375,8 @@ private void resolveTo(
375
375
public String [] provide (String [] original , Object localRequest , boolean supportsReplace ) {
376
376
final IndicesOptions indicesOptions = indicesOptionsFrom (localRequest );
377
377
final boolean enableCrossClusterResolution = localRequest instanceof FieldCapabilitiesRequest
378
- || localRequest instanceof SearchRequest
379
- || localRequest instanceof ResolveIndexAction .Request ;
378
+ || localRequest instanceof SearchRequest
379
+ || localRequest instanceof ResolveIndexAction .Request ;
380
380
// skip the whole thing if we have seen this exact resolveIndexPatterns request
381
381
final AlreadyResolvedKey alreadyResolvedKey ;
382
382
if (original != null ) {
@@ -392,8 +392,8 @@ public String[] provide(String[] original, Object localRequest, boolean supports
392
392
393
393
Resolved resolved (IndicesOptions indicesOptions ) {
394
394
final Resolved resolved = alreadyResolved .isEmpty ()
395
- ? Resolved ._LOCAL_ALL
396
- : new Resolved (aliases .build (), allIndices .build (), originalRequested .build (), remoteIndices .build (), indicesOptions );
395
+ ? Resolved ._LOCAL_ALL
396
+ : new Resolved (aliases .build (), allIndices .build (), originalRequested .build (), remoteIndices .build (), indicesOptions );
397
397
398
398
if (log .isTraceEnabled ()) {
399
399
log .trace ("Finally resolved for {}: {}" , name , resolved );
@@ -413,7 +413,7 @@ public String[] provide(String[] original, Object request, boolean supportsRepla
413
413
if (retainMode && !isAllWithNoRemote (original )) {
414
414
final Resolved resolved = resolveRequest (request );
415
415
final List <String > retained = WildcardMatcher .from (resolved .getAllIndices ())
416
- .getMatchAny (replacements , Collectors .toList ());
416
+ .getMatchAny (replacements , Collectors .toList ());
417
417
retained .addAll (resolved .getRemoteIndices ());
418
418
return retained .toArray (new String [0 ]);
419
419
}
@@ -442,11 +442,11 @@ public final static class Resolved {
442
442
private static final ImmutableSet <String > All_SET = ImmutableSet .of (ANY );
443
443
private static final Set <String > types = All_SET ;
444
444
public static final Resolved _LOCAL_ALL = new Resolved (
445
- All_SET ,
446
- All_SET ,
447
- All_SET ,
448
- ImmutableSet .of (),
449
- SearchRequest .DEFAULT_INDICES_OPTIONS
445
+ All_SET ,
446
+ All_SET ,
447
+ All_SET ,
448
+ ImmutableSet .of (),
449
+ SearchRequest .DEFAULT_INDICES_OPTIONS
450
450
);
451
451
452
452
private final Set <String > aliases ;
@@ -457,18 +457,18 @@ public final static class Resolved {
457
457
private final IndicesOptions indicesOptions ;
458
458
459
459
public Resolved (
460
- final ImmutableSet <String > aliases ,
461
- final ImmutableSet <String > allIndices ,
462
- final ImmutableSet <String > originalRequested ,
463
- final ImmutableSet <String > remoteIndices ,
464
- IndicesOptions indicesOptions
460
+ final ImmutableSet <String > aliases ,
461
+ final ImmutableSet <String > allIndices ,
462
+ final ImmutableSet <String > originalRequested ,
463
+ final ImmutableSet <String > remoteIndices ,
464
+ IndicesOptions indicesOptions
465
465
) {
466
466
this .aliases = aliases ;
467
467
this .allIndices = allIndices ;
468
468
this .originalRequested = originalRequested ;
469
469
this .remoteIndices = remoteIndices ;
470
470
this .isLocalAll = IndexResolverReplacer .isLocalAll (originalRequested .toArray (new String [0 ]))
471
- || (aliases .contains ("*" ) && allIndices .contains ("*" ));
471
+ || (aliases .contains ("*" ) && allIndices .contains ("*" ));
472
472
this .indicesOptions = indicesOptions ;
473
473
}
474
474
@@ -507,16 +507,16 @@ public Set<String> getRemoteIndices() {
507
507
@ Override
508
508
public String toString () {
509
509
return "Resolved [aliases="
510
- + aliases
511
- + ", allIndices="
512
- + allIndices
513
- + ", types="
514
- + types
515
- + ", originalRequested="
516
- + originalRequested
517
- + ", remoteIndices="
518
- + remoteIndices
519
- + "]" ;
510
+ + aliases
511
+ + ", allIndices="
512
+ + allIndices
513
+ + ", types="
514
+ + types
515
+ + ", originalRequested="
516
+ + originalRequested
517
+ + ", remoteIndices="
518
+ + remoteIndices
519
+ + "]" ;
520
520
}
521
521
522
522
@ Override
@@ -690,14 +690,14 @@ private boolean getOrReplaceAllIndices(final Object request, final IndicesProvid
690
690
691
691
if (snapshotInfo == null ) {
692
692
log .warn (
693
- "snapshot repository '" + restoreRequest .repository () + "', snapshot '" + restoreRequest .snapshot () + "' not found"
693
+ "snapshot repository '" + restoreRequest .repository () + "', snapshot '" + restoreRequest .snapshot () + "' not found"
694
694
);
695
695
provider .provide (new String [] { "*" }, request , false );
696
696
} else {
697
697
final List <String > requestedResolvedIndices = IndexUtils .filterIndices (
698
- snapshotInfo .indices (),
699
- restoreRequest .indices (),
700
- restoreRequest .indicesOptions ()
698
+ snapshotInfo .indices (),
699
+ restoreRequest .indices (),
700
+ restoreRequest .indicesOptions ()
701
701
);
702
702
final List <String > renamedTargetIndices = renamedIndices (restoreRequest , requestedResolvedIndices );
703
703
// final Set<String> indices = new HashSet<>(requestedResolvedIndices);
0 commit comments