@@ -102,6 +102,12 @@ protected boolean isHttps() {
102102 return isHttps ;
103103 }
104104
105+ /** Check if we're running against Amazon OpenSearch Serverless (AOSS) */
106+ protected boolean isAossCluster () {
107+ String clusterUrl = System .getProperty ("tests.rest.cluster" );
108+ return clusterUrl != null && clusterUrl .contains (".aoss.amazonaws.com" );
109+ }
110+
105111 protected String getProtocol () {
106112 return isHttps () ? "https" : "http" ;
107113 }
@@ -396,6 +402,11 @@ public void configureMultiClusters(String remote) throws IOException {
396402 * @throws IOException if there is an error retrieving cluster settings or updating them
397403 */
398404 protected void increaseMaxCompilationsRate () throws IOException {
405+ // Skip script compilation rate configuration for AOSS
406+ if (isAossCluster ()) {
407+ return ; // AOSS doesn't support cluster settings or script context APIs
408+ }
409+
399410 // When script.disable_max_compilations_rate is set, custom context compilation rates cannot be
400411 // set
401412 if (!Objects .equals (
@@ -447,6 +458,15 @@ protected static void updateClusterSetting(String settingKey, Object value, bool
447458 }
448459
449460 protected static JSONObject getAllClusterSettings () throws IOException {
461+ // Skip cluster settings retrieval for AOSS as it doesn't support this API
462+ String clusterUrl = System .getProperty ("tests.rest.cluster" );
463+ boolean isAoss = clusterUrl != null && clusterUrl .contains (".aoss.amazonaws.com" );
464+
465+ if (isAoss ) {
466+ // Return a mock settings object with default values for AOSS
467+ return new JSONObject ("{\" persistent\" :{},\" transient\" :{},\" defaults\" :{}}" );
468+ }
469+
450470 Request request = new Request ("GET" , "/_cluster/settings?flat_settings&include_defaults" );
451471 RequestOptions .Builder restOptionsBuilder = RequestOptions .DEFAULT .toBuilder ();
452472 restOptionsBuilder .addHeader ("Content-Type" , "application/json" );
@@ -455,6 +475,24 @@ protected static JSONObject getAllClusterSettings() throws IOException {
455475 }
456476
457477 protected static String getClusterSetting (String settingPath , String type ) throws IOException {
478+ // For AOSS, return appropriate default values for commonly checked settings
479+ String clusterUrl = System .getProperty ("tests.rest.cluster" );
480+ boolean isAoss = clusterUrl != null && clusterUrl .contains (".aoss.amazonaws.com" );
481+
482+ if (isAoss ) {
483+ // Return sensible defaults for AOSS
484+ if (settingPath .contains ("calcite.engine.enabled" )) {
485+ return "false" ; // Assume calcite is disabled for AOSS by default
486+ }
487+ if (settingPath .contains ("calcite.pushdown.enabled" )) {
488+ return "true" ; // Assume pushdown is enabled for AOSS by default
489+ }
490+ if (settingPath .contains ("script.disable_max_compilations_rate" )) {
491+ return "true" ; // Assume script rate limiting is disabled for AOSS
492+ }
493+ return "" ; // Default empty value for other settings
494+ }
495+
458496 JSONObject settings = getAllClusterSettings ();
459497 String value = settings .optJSONObject (type ).optString (settingPath );
460498 if (StringUtils .isEmpty (value )) {
0 commit comments