diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/AutoFollowStats.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/AutoFollowStats.java index bb286b6e5d5..394adb3b191 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/AutoFollowStats.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/AutoFollowStats.java @@ -47,7 +47,9 @@ public final class AutoFollowStats { static final ParseField LAST_SEEN_METADATA_VERSION = new ParseField("last_seen_metadata_version"); @SuppressWarnings("unchecked") - static final ConstructingObjectParser STATS_PARSER = new ConstructingObjectParser<>("auto_follow_stats", + static final ConstructingObjectParser STATS_PARSER = new ConstructingObjectParser<>( + "auto_follow_stats", + true, args -> new AutoFollowStats( (Long) args[0], (Long) args[1], @@ -65,11 +67,13 @@ public final class AutoFollowStats { static final ConstructingObjectParser>, Void> AUTO_FOLLOW_EXCEPTIONS_PARSER = new ConstructingObjectParser<>( "auto_follow_stats_errors", + true, args -> new AbstractMap.SimpleEntry<>((String) args[0], Tuple.tuple((Long) args[1], (ElasticsearchException) args[2]))); private static final ConstructingObjectParser, Void> AUTO_FOLLOWED_CLUSTERS_PARSER = new ConstructingObjectParser<>( "auto_followed_clusters", + true, args -> new AbstractMap.SimpleEntry<>((String) args[0], new AutoFollowedCluster((Long) args[1], (Long) args[2]))); static { diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/CcrStatsResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/CcrStatsResponse.java index 889a96683bf..54f79892c1d 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/CcrStatsResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/CcrStatsResponse.java @@ -28,7 +28,9 @@ public final class CcrStatsResponse { static final ParseField AUTO_FOLLOW_STATS_FIELD = new ParseField("auto_follow_stats"); static final ParseField FOLLOW_STATS_FIELD = new ParseField("follow_stats"); - private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>("indices", + private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( + "indices", + true, args -> { AutoFollowStats autoFollowStats = (AutoFollowStats) args[0]; IndicesFollowStats indicesFollowStats = (IndicesFollowStats) args[1]; diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponse.java index ce42c98e57c..d05ab3f3ee3 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponse.java @@ -42,7 +42,7 @@ public final class GetAutoFollowPatternResponse { static final ParseField PATTERN_FIELD = new ParseField("pattern"); private static final ConstructingObjectParser, Void> ENTRY_PARSER = new ConstructingObjectParser<>( - "get_auto_follow_pattern_response", args -> new AbstractMap.SimpleEntry<>((String) args[0], (Pattern) args[1])); + "get_auto_follow_pattern_response", true, args -> new AbstractMap.SimpleEntry<>((String) args[0], (Pattern) args[1])); static { ENTRY_PARSER.declareString(ConstructingObjectParser.constructorArg(), NAME_FIELD); @@ -50,7 +50,7 @@ public final class GetAutoFollowPatternResponse { } private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( - "get_auto_follow_pattern_response", args -> { + "get_auto_follow_pattern_response", true, args -> { @SuppressWarnings("unchecked") List> entries = (List>) args[0]; return new GetAutoFollowPatternResponse(new TreeMap<>(entries.stream() @@ -92,7 +92,7 @@ public final class GetAutoFollowPatternResponse { @SuppressWarnings("unchecked") private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( - "pattern", args -> new Pattern((String) args[0], (List) args[1], (String) args[2])); + "pattern", true, args -> new Pattern((String) args[0], (List) args[1], (String) args[2])); static { PARSER.declareString(ConstructingObjectParser.constructorArg(), PutFollowRequest.REMOTE_CLUSTER_FIELD); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/IndicesFollowStats.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/IndicesFollowStats.java index 02e2fc4f4ed..7d3af08577b 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/IndicesFollowStats.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/IndicesFollowStats.java @@ -41,6 +41,7 @@ public final class IndicesFollowStats { private static final ConstructingObjectParser>, Void> ENTRY_PARSER = new ConstructingObjectParser<>( "entry", + true, args -> { String index = (String) args[0]; @SuppressWarnings("unchecked") @@ -54,7 +55,9 @@ public final class IndicesFollowStats { ENTRY_PARSER.declareObjectArray(ConstructingObjectParser.constructorArg(), ShardFollowStats.PARSER, SHARDS_FIELD); } - static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>("indices", + static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( + "indices", + true, args -> { @SuppressWarnings("unchecked") List>> entries = (List>>) args[0]; @@ -116,6 +119,7 @@ public final class IndicesFollowStats { static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( "shard-follow-stats", + true, args -> new ShardFollowStats( (String) args[0], (String) args[1], @@ -152,6 +156,7 @@ public final class IndicesFollowStats { static final ConstructingObjectParser>, Void> READ_EXCEPTIONS_ENTRY_PARSER = new ConstructingObjectParser<>( "shard-follow-stats-read-exceptions-entry", + true, args -> new AbstractMap.SimpleEntry<>((long) args[0], Tuple.tuple((Integer) args[1], (ElasticsearchException)args[2]))); static { diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutFollowResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutFollowResponse.java index 2d928b85988..3841b868e73 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutFollowResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutFollowResponse.java @@ -33,7 +33,7 @@ public final class PutFollowResponse { static final ParseField INDEX_FOLLOWING_STARTED = new ParseField("index_following_started"); private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( - "put_follow_response", args -> new PutFollowResponse((boolean) args[0], (boolean) args[1], (boolean) args[2])); + "put_follow_response", true, args -> new PutFollowResponse((boolean) args[0], (boolean) args[1], (boolean) args[2])); static { PARSER.declareBoolean(ConstructingObjectParser.constructorArg(), FOLLOW_INDEX_CREATED); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/CcrStatsResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/CcrStatsResponseTests.java index b818b7ae421..cb8072f6baf 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/CcrStatsResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/CcrStatsResponseTests.java @@ -51,7 +51,7 @@ public class CcrStatsResponseTests extends ESTestCase { CcrStatsResponseTests::createTestInstance, CcrStatsResponseTests::toXContent, CcrStatsResponse::fromXContent) - .supportsUnknownFields(false) + .supportsUnknownFields(true) .assertEqualsConsumer(CcrStatsResponseTests::assertEqualInstances) .assertToXContentEquivalence(false) .test(); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/FollowStatsResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/FollowStatsResponseTests.java index c8d15bc5085..5ec3cb4edcf 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/FollowStatsResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/FollowStatsResponseTests.java @@ -48,7 +48,7 @@ public class FollowStatsResponseTests extends ESTestCase { FollowStatsResponseTests::createTestInstance, FollowStatsResponseTests::toXContent, FollowStatsResponse::fromXContent) - .supportsUnknownFields(false) + .supportsUnknownFields(true) .assertEqualsConsumer(FollowStatsResponseTests::assertEqualInstances) .assertToXContentEquivalence(false) .test(); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponseTests.java index b4a37286b4a..f6f0f1747e2 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponseTests.java @@ -43,7 +43,7 @@ public class GetAutoFollowPatternResponseTests extends ESTestCase { this::createTestInstance, GetAutoFollowPatternResponseTests::toXContent, GetAutoFollowPatternResponse::fromXContent) - .supportsUnknownFields(false) + .supportsUnknownFields(true) .test(); } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/PutFollowRequestTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/PutFollowRequestTests.java index 0814278a0cf..35353ce4a96 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/PutFollowRequestTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/PutFollowRequestTests.java @@ -31,7 +31,7 @@ import java.io.IOException; public class PutFollowRequestTests extends AbstractXContentTestCase { private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>("test_parser", - (args) -> new PutFollowRequest((String) args[0], (String) args[1], (String) args[2])); + true, (args) -> new PutFollowRequest((String) args[0], (String) args[1], (String) args[2])); static { PARSER.declareString(ConstructingObjectParser.constructorArg(), PutFollowRequest.REMOTE_CLUSTER_FIELD); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/PutFollowResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/PutFollowResponseTests.java index 48eb15717c5..00bcf535f08 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/PutFollowResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/PutFollowResponseTests.java @@ -33,7 +33,7 @@ public class PutFollowResponseTests extends ESTestCase { this::createTestInstance, PutFollowResponseTests::toXContent, PutFollowResponse::fromXContent) - .supportsUnknownFields(false) + .supportsUnknownFields(true) .test(); }