@@ -176,11 +176,7 @@ private <C, V> void assertResultMapForLike(
176176 requiredCapabilities .add ("like_list_on_index_fields" );
177177 }
178178 // the feature is completely supported if both local and remote clusters support it
179- boolean isSupported = clusterHasCapability ("POST" , "/_query" , List .of (), requiredCapabilities ).orElse (false );
180- try (RestClient remoteClient = remoteClusterClient ()) {
181- isSupported = isSupported
182- && clusterHasCapability (remoteClient , "POST" , "/_query" , List .of (), requiredCapabilities ).orElse (false );
183- }
179+ boolean isSupported = capabilitiesSupportedNewAndOld (requiredCapabilities );
184180
185181 if (isSupported ) {
186182 assertResultMap (includeCCSMetadata , result , columns , values , remoteOnly );
@@ -193,6 +189,15 @@ private <C, V> void assertResultMapForLike(
193189 }
194190 }
195191
192+ private boolean capabilitiesSupportedNewAndOld (List <String > requiredCapabilities ) throws IOException {
193+ boolean isSupported = clusterHasCapability ("POST" , "/_query" , List .of (), requiredCapabilities ).orElse (false );
194+ try (RestClient remoteClient = remoteClusterClient ()) {
195+ isSupported = isSupported
196+ && clusterHasCapability (remoteClient , "POST" , "/_query" , List .of (), requiredCapabilities ).orElse (false );
197+ }
198+ return isSupported ;
199+ }
200+
196201 private <C , V > void assertResultMap (boolean includeCCSMetadata , Map <String , Object > result , C columns , V values , boolean remoteOnly ) {
197202 MapMatcher mapMatcher = getResultMatcher (
198203 ccsMetadataAvailable (),
@@ -438,6 +443,12 @@ public void testNotLikeIndex() throws Exception {
438443 }
439444
440445 public void testLikeListIndex () throws Exception {
446+ List <String > requiredCapabilities = new ArrayList <>(List .of ("like_list_on_index_fields" ));
447+ // the feature is completely supported if both local and remote clusters support it
448+ if (capabilitiesSupportedNewAndOld (requiredCapabilities ) == false ) {
449+ logger .info ("--> skipping testNotLikeListIndex, due to missing capability" );
450+ return ;
451+ }
441452 boolean includeCCSMetadata = includeCCSMetadata ();
442453 Map <String , Object > result = run ("""
443454 FROM test-local-index,*:test-remote-index METADATA _index
@@ -453,6 +464,12 @@ public void testLikeListIndex() throws Exception {
453464 }
454465
455466 public void testNotLikeListIndex () throws Exception {
467+ List <String > requiredCapabilities = new ArrayList <>(List .of ("like_list_on_index_fields" ));
468+ // the feature is completely supported if both local and remote clusters support it
469+ if (capabilitiesSupportedNewAndOld (requiredCapabilities ) == false ) {
470+ logger .info ("--> skipping testNotLikeListIndex, due to missing capability" );
471+ return ;
472+ }
456473 boolean includeCCSMetadata = includeCCSMetadata ();
457474 Map <String , Object > result = run ("""
458475 FROM test-local-index,*:test-remote-index METADATA _index
@@ -467,6 +484,27 @@ public void testNotLikeListIndex() throws Exception {
467484 assertResultMapForLike (includeCCSMetadata , result , columns , values , false , true );
468485 }
469486
487+ public void testNotLikeListKeyWord () throws Exception {
488+ List <String > requiredCapabilities = new ArrayList <>(List .of ("like_list_on_index_fields" ));
489+ // the feature is completely supported if both local and remote clusters support it
490+ if (capabilitiesSupportedNewAndOld (requiredCapabilities ) == false ) {
491+ logger .info ("--> skipping testNotLikeListIndex, due to missing capability" );
492+ return ;
493+ }
494+ boolean includeCCSMetadata = includeCCSMetadata ();
495+ Map <String , Object > result = run ("""
496+ FROM test-local-index,*:test-remote-index METADATA _index
497+ | WHERE color NOT LIKE ("*blue*", "*red*")
498+ | STATS c = COUNT(*) BY _index
499+ | SORT _index ASC
500+ """ , includeCCSMetadata );
501+ var columns = List .of (Map .of ("name" , "c" , "type" , "long" ), Map .of ("name" , "_index" , "type" , "keyword" ));
502+ var values = List .of (List .of (localDocs .size (), localIndex ));
503+ String resultString = Strings .toString (JsonXContent .contentBuilder ().prettyPrint ().map (result ));
504+ System .out .println (resultString );
505+ assertResultMapForLike (includeCCSMetadata , result , columns , values , false , true );
506+ }
507+
470508 public void testRLikeIndex () throws Exception {
471509 boolean includeCCSMetadata = includeCCSMetadata ();
472510 Map <String , Object > result = run ("""
0 commit comments