@@ -431,9 +431,16 @@ public record CrossProjectModeOptions(boolean resolveIndexExpression) implements
431431
432432 private static final String INDEX_EXPRESSION_NAME = "resolve_cross_project_index_expression" ;
433433
434+ public static CrossProjectModeOptions parseParameter (Object resolveIndexExpression , CrossProjectModeOptions defaultOptions ) {
435+ if (resolveIndexExpression == null ) {
436+ return defaultOptions != null ? defaultOptions : DEFAULT ;
437+ }
438+ return new CrossProjectModeOptions (nodeBooleanValue (resolveIndexExpression , INDEX_EXPRESSION_NAME ));
439+ }
440+
434441 @ Override
435442 public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
436- return builder .field (INDEX_EXPRESSION_NAME , resolveIndexExpression );
443+ return resolveIndexExpression ? builder .field (INDEX_EXPRESSION_NAME , resolveIndexExpression ) : builder ;
437444 }
438445
439446 @ Override
@@ -1198,6 +1205,7 @@ public static IndicesOptions fromMap(Map<String, Object> map, IndicesOptions def
11981205 : map .get ("ignoreUnavailable" ),
11991206 map .containsKey (WildcardOptions .ALLOW_NO_INDICES ) ? map .get (WildcardOptions .ALLOW_NO_INDICES ) : map .get ("allowNoIndices" ),
12001207 map .containsKey (GatekeeperOptions .IGNORE_THROTTLED ) ? map .get (GatekeeperOptions .IGNORE_THROTTLED ) : map .get ("ignoreThrottled" ),
1208+ map .get (CrossProjectModeOptions .INDEX_EXPRESSION_NAME ),
12011209 defaultSettings
12021210 );
12031211 }
@@ -1214,8 +1222,7 @@ public static boolean isIndicesOptions(String name) {
12141222 || GatekeeperOptions .IGNORE_THROTTLED .equals (name )
12151223 || "ignoreThrottled" .equals (name )
12161224 || WildcardOptions .ALLOW_NO_INDICES .equals (name )
1217- || "allowNoIndices" .equals (name )
1218- || CrossProjectModeOptions .INDEX_EXPRESSION_NAME .equals (name );
1225+ || "allowNoIndices" .equals (name );
12191226 }
12201227
12211228 public static IndicesOptions fromParameters (
@@ -1228,12 +1235,32 @@ public static IndicesOptions fromParameters(
12281235 return fromParameters (wildcardsString , ignoreUnavailableString , allowNoIndicesString , ignoreThrottled , null , defaultSettings );
12291236 }
12301237
1238+ public static IndicesOptions fromParameters (
1239+ Object wildcardsString ,
1240+ Object ignoreUnavailableString ,
1241+ Object allowNoIndicesString ,
1242+ Object ignoreThrottled ,
1243+ Object resolveCrossProject ,
1244+ IndicesOptions defaultSettings
1245+ ) {
1246+ return fromParameters (
1247+ wildcardsString ,
1248+ ignoreUnavailableString ,
1249+ allowNoIndicesString ,
1250+ ignoreThrottled ,
1251+ null ,
1252+ resolveCrossProject ,
1253+ defaultSettings
1254+ );
1255+ }
1256+
12311257 public static IndicesOptions fromParameters (
12321258 Object wildcardsString ,
12331259 Object ignoreUnavailableString ,
12341260 Object allowNoIndicesString ,
12351261 Object ignoreThrottled ,
12361262 Object failureStoreString ,
1263+ Object resolveCrossProject ,
12371264 IndicesOptions defaultSettings
12381265 ) {
12391266 if (wildcardsString == null
@@ -1252,6 +1279,7 @@ public static IndicesOptions fromParameters(
12521279 .concreteTargetOptions (ConcreteTargetOptions .fromParameter (ignoreUnavailableString , defaultSettings .concreteTargetOptions ))
12531280 .wildcardOptions (wildcards )
12541281 .gatekeeperOptions (gatekeeperOptions )
1282+ .crossProjectModeOptions (CrossProjectModeOptions .parseParameter (resolveCrossProject , defaultSettings .crossProjectModeOptions ))
12551283 .build ();
12561284 }
12571285
0 commit comments