@@ -1170,6 +1170,7 @@ protected static void wipeAllIndices(boolean preserveSecurityIndices) throws IOE
11701170 }
11711171 final Request deleteRequest = new Request ("DELETE" , Strings .collectionToCommaDelimitedString (indexPatterns ));
11721172 deleteRequest .addParameter ("expand_wildcards" , "open,closed" + (includeHidden ? ",hidden" : "" ));
1173+ deleteRequest .setOptions (deleteRequest .getOptions ().toBuilder ().setWarningsHandler (ignoreAsyncSearchWarning ()).build ());
11731174 final Response response = adminClient ().performRequest (deleteRequest );
11741175 try (InputStream is = response .getEntity ().getContent ()) {
11751176 assertTrue ((boolean ) XContentHelper .convertToMap (XContentType .JSON .xContent (), is , true ).get ("acknowledged" ));
@@ -1182,6 +1183,30 @@ protected static void wipeAllIndices(boolean preserveSecurityIndices) throws IOE
11821183 }
11831184 }
11841185
1186+ // Make warnings handler that ignores the .async-search warning since .async-search may randomly appear when async requests are slow
1187+ // See: https://github.com/elastic/elasticsearch/issues/117099
1188+ protected static WarningsHandler ignoreAsyncSearchWarning () {
1189+ return new WarningsHandler () {
1190+ @ Override
1191+ public boolean warningsShouldFailRequest (List <String > warnings ) {
1192+ if (warnings .isEmpty ()) {
1193+ return false ;
1194+ }
1195+ return warnings .equals (
1196+ List .of (
1197+ "this request accesses system indices: [.async-search], "
1198+ + "but in a future major version, direct access to system indices will be prevented by default"
1199+ )
1200+ ) == false ;
1201+ }
1202+
1203+ @ Override
1204+ public String toString () {
1205+ return "ignore .async-search warning" ;
1206+ }
1207+ };
1208+ }
1209+
11851210 protected static void wipeDataStreams () throws IOException {
11861211 try {
11871212 if (hasXPack ()) {
0 commit comments