diff --git a/modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/BucketSelectorPipelineAggregationBuilder.java b/modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/BucketSelectorPipelineAggregationBuilder.java index 2271bbe44d3f5..1d8934a26251f 100644 --- a/modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/BucketSelectorPipelineAggregationBuilder.java +++ b/modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/BucketSelectorPipelineAggregationBuilder.java @@ -48,7 +48,7 @@ public BucketSelectorPipelineAggregationBuilder(String name, Map */ public BucketSelectorPipelineAggregationBuilder(StreamInput in) throws IOException { super(in, NAME); - bucketsPathsMap = in.readMap(StreamInput::readString, StreamInput::readString); + bucketsPathsMap = in.readMap(StreamInput::readString); script = new Script(in); gapPolicy = GapPolicy.readFrom(in); } diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java index 633b8d1986901..adaf7e0d6c4d7 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java @@ -98,7 +98,7 @@ public static class Response extends ActionResponse implements ToXContentObject Response(StreamInput in) throws IOException { super(in); - grokPatterns = in.readMap(StreamInput::readString, StreamInput::readString); + grokPatterns = in.readMap(StreamInput::readString); } public Map getGrokPatterns() { diff --git a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpTaskState.java b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpTaskState.java index c924c19210f44..b5024c7c0f8ec 100644 --- a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpTaskState.java +++ b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpTaskState.java @@ -67,10 +67,7 @@ public static GeoIpTaskState fromXContent(XContentParser parser) throws IOExcept } GeoIpTaskState(StreamInput input) throws IOException { - databases = input.readImmutableMap(StreamInput::readString, in -> { - long lastUpdate = in.readLong(); - return new Metadata(lastUpdate, in.readVInt(), in.readVInt(), in.readString(), in.readLong()); - }); + databases = input.readImmutableMap(in -> new Metadata(in.readLong(), in.readVInt(), in.readVInt(), in.readString(), in.readLong())); } public GeoIpTaskState put(String name, Metadata metadata) { diff --git a/server/src/main/java/org/elasticsearch/ElasticsearchException.java b/server/src/main/java/org/elasticsearch/ElasticsearchException.java index abf13b2c23dbb..9b32e04b43e6a 100644 --- a/server/src/main/java/org/elasticsearch/ElasticsearchException.java +++ b/server/src/main/java/org/elasticsearch/ElasticsearchException.java @@ -145,8 +145,8 @@ public ElasticsearchException(String msg, Throwable cause, Object... args) { public ElasticsearchException(StreamInput in) throws IOException { super(in.readOptionalString(), in.readException()); readStackTrace(this, in); - headers.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString)); - metadata.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString)); + headers.putAll(in.readMapOfLists(StreamInput::readString)); + metadata.putAll(in.readMapOfLists(StreamInput::readString)); } /** diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/DesiredBalanceResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/DesiredBalanceResponse.java index 3ffade0159b92..28760cdb0d209 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/DesiredBalanceResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/DesiredBalanceResponse.java @@ -61,7 +61,7 @@ public static DesiredBalanceResponse from(StreamInput in) throws IOException { in.getTransportVersion().onOrAfter(CLUSTER_BALANCE_STATS_VERSION) ? ClusterBalanceStats.readFrom(in) : ClusterBalanceStats.EMPTY, - in.readImmutableMap(StreamInput::readString, v -> v.readImmutableMap(StreamInput::readVInt, DesiredShards::from)), + in.readImmutableMap(v -> v.readImmutableMap(StreamInput::readVInt, DesiredShards::from)), in.getTransportVersion().onOrAfter(CLUSTER_INFO_VERSION) ? new ClusterInfo(in) : ClusterInfo.EMPTY ); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/shards/ClusterSearchShardsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/shards/ClusterSearchShardsResponse.java index f627eafab447e..9c127b6360f90 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/shards/ClusterSearchShardsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/shards/ClusterSearchShardsResponse.java @@ -30,7 +30,7 @@ public ClusterSearchShardsResponse(StreamInput in) throws IOException { super(in); groups = in.readArray(ClusterSearchShardsGroup::new, ClusterSearchShardsGroup[]::new); nodes = in.readArray(DiscoveryNode::new, DiscoveryNode[]::new); - indicesAndFilters = in.readMap(StreamInput::readString, AliasFilter::readFrom); + indicesAndFilters = in.readMap(AliasFilter::readFrom); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java index 91b1740777d82..251d2976dac7a 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java @@ -94,7 +94,7 @@ public GetSnapshotsResponse( public GetSnapshotsResponse(StreamInput in) throws IOException { this.snapshots = in.readImmutableList(SnapshotInfo::readFrom); if (in.getTransportVersion().onOrAfter(GetSnapshotsRequest.MULTIPLE_REPOSITORIES_SUPPORT_ADDED)) { - final Map failedResponses = in.readMap(StreamInput::readString, StreamInput::readException); + final Map failedResponses = in.readMap(StreamInput::readException); this.failures = Collections.unmodifiableMap(failedResponses); this.next = in.readOptionalString(); } else { diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/shard/GetShardSnapshotResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/shard/GetShardSnapshotResponse.java index 08870248f2b8d..b17ccf5d56d1d 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/shard/GetShardSnapshotResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/shard/GetShardSnapshotResponse.java @@ -34,7 +34,7 @@ public class GetShardSnapshotResponse extends ActionResponse { GetShardSnapshotResponse(StreamInput in) throws IOException { super(in); this.latestShardSnapshot = in.readOptionalWriteable(ShardSnapshotInfo::new); - this.repositoryFailures = in.readMap(StreamInput::readString, RepositoryException::new); + this.repositoryFailures = in.readMap(RepositoryException::new); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/SearchUsageStats.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/SearchUsageStats.java index 639fb4b777155..fa60016e93f94 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/SearchUsageStats.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/SearchUsageStats.java @@ -51,8 +51,8 @@ public SearchUsageStats(Map queries, Map sections, l } public SearchUsageStats(StreamInput in) throws IOException { - this.queries = in.readMap(StreamInput::readString, StreamInput::readLong); - this.sections = in.readMap(StreamInput::readString, StreamInput::readLong); + this.queries = in.readMap(StreamInput::readLong); + this.sections = in.readMap(StreamInput::readLong); this.totalSearchCount = in.readVLong(); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java index a9c527a4fddf1..1ea6be9fea91b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java @@ -32,7 +32,7 @@ public GetAliasesResponse(Map> aliases, Map i.readList(AliasMetadata::new)); - dataStreamAliases = in.readMap(StreamInput::readString, in1 -> in1.readList(DataStreamAlias::new)); + dataStreamAliases = in.readMap(in1 -> in1.readList(DataStreamAlias::new)); } public Map> getAliases() { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/analyze/ReloadAnalyzersResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/analyze/ReloadAnalyzersResponse.java index daff9c9b3b461..0e6149476659c 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/analyze/ReloadAnalyzersResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/analyze/ReloadAnalyzersResponse.java @@ -45,7 +45,7 @@ public class ReloadAnalyzersResponse extends BroadcastResponse { public ReloadAnalyzersResponse(StreamInput in) throws IOException { super(in); - this.reloadDetails = in.readMap(StreamInput::readString, ReloadDetails::new); + this.reloadDetails = in.readMap(ReloadDetails::new); } public ReloadAnalyzersResponse( diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/diskusage/AnalyzeIndexDiskUsageResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/diskusage/AnalyzeIndexDiskUsageResponse.java index 0fc1e9c01dc24..ce3c3f9897e4e 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/diskusage/AnalyzeIndexDiskUsageResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/diskusage/AnalyzeIndexDiskUsageResponse.java @@ -34,7 +34,7 @@ public final class AnalyzeIndexDiskUsageResponse extends BroadcastResponse { AnalyzeIndexDiskUsageResponse(StreamInput in) throws IOException { super(in); - stats = in.readMap(StreamInput::readString, IndexDiskUsageStats::new); + stats = in.readMap(IndexDiskUsageStats::new); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/diskusage/IndexDiskUsageStats.java b/server/src/main/java/org/elasticsearch/action/admin/indices/diskusage/IndexDiskUsageStats.java index 7534f6653e470..6052543939819 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/diskusage/IndexDiskUsageStats.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/diskusage/IndexDiskUsageStats.java @@ -55,7 +55,7 @@ public IndexDiskUsageStats(long indexSizeInBytes) { } public IndexDiskUsageStats(StreamInput in) throws IOException { - this.fields = new HashMap<>(in.readMap(StreamInput::readString, PerFieldDiskUsage::new)); + this.fields = new HashMap<>(in.readMap(PerFieldDiskUsage::new)); this.indexSizeInBytes = in.readVLong(); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java index fd6c815a7462b..03d2b05e09374 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java @@ -51,7 +51,7 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte GetFieldMappingsResponse(StreamInput in) throws IOException { super(in); - mappings = in.readImmutableMap(StreamInput::readString, mapIn -> { + mappings = in.readImmutableMap(mapIn -> { if (mapIn.getTransportVersion().before(TransportVersion.V_8_0_0)) { int typesSize = mapIn.readVInt(); assert typesSize == 1 || typesSize == 0 : "Expected 0 or 1 types but got " + typesSize; @@ -60,10 +60,7 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte } mapIn.readString(); // type } - return mapIn.readImmutableMap( - StreamInput::readString, - inpt -> new FieldMappingMetadata(inpt.readString(), inpt.readBytesReference()) - ); + return mapIn.readImmutableMap(inpt -> new FieldMappingMetadata(inpt.readString(), inpt.readBytesReference())); }); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java index 22688f9f81a62..0ea5911a77e12 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java @@ -40,7 +40,7 @@ public GetMappingsResponse(Map mappings) { GetMappingsResponse(StreamInput in) throws IOException { super(in); - mappings = in.readImmutableMap(StreamInput::readString, in.getTransportVersion().before(TransportVersion.V_8_0_0) ? i -> { + mappings = in.readImmutableMap(in.getTransportVersion().before(TransportVersion.V_8_0_0) ? i -> { int mappingCount = i.readVInt(); assert mappingCount == 1 || mappingCount == 0 : "Expected 0 or 1 mappings but got " + mappingCount; if (mappingCount == 1) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/recovery/RecoveryResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/recovery/RecoveryResponse.java index ea04ccf627633..a3b9432756b1f 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/recovery/RecoveryResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/recovery/RecoveryResponse.java @@ -32,7 +32,7 @@ public class RecoveryResponse extends BaseBroadcastResponse implements ChunkedTo public RecoveryResponse(StreamInput in) throws IOException { super(in); - shardRecoveryStates = in.readMapOfLists(StreamInput::readString, RecoveryState::readRecoveryState); + shardRecoveryStates = in.readMapOfLists(RecoveryState::readRecoveryState); } /** diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java index fa95a93183c56..c3bb5dc71dc12 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java @@ -40,8 +40,8 @@ public GetSettingsResponse(Map indexToSettings, Map>> s public IndicesShardStoresResponse(StreamInput in) throws IOException { super(in); - storeStatuses = in.readImmutableMap( - StreamInput::readString, - i -> i.readImmutableMap(StreamInput::readInt, j -> j.readImmutableList(StoreStatus::new)) - ); + storeStatuses = in.readImmutableMap(i -> i.readImmutableMap(StreamInput::readInt, j -> j.readImmutableList(StoreStatus::new))); failures = in.readImmutableList(Failure::readFailure); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/FieldUsageStatsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/FieldUsageStatsResponse.java index 9b2efa83746e2..3b5f919816708 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/FieldUsageStatsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/FieldUsageStatsResponse.java @@ -35,7 +35,7 @@ public class FieldUsageStatsResponse extends ChunkedBroadcastResponse { FieldUsageStatsResponse(StreamInput in) throws IOException { super(in); - stats = in.readMap(StreamInput::readString, i -> i.readList(FieldUsageShardResponse::new)); + stats = in.readMap(i -> i.readList(FieldUsageShardResponse::new)); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java index 76566e03bcdf1..399a1908061e1 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java @@ -52,8 +52,8 @@ public class IndicesStatsResponse extends ChunkedBroadcastResponse { super(in); shards = in.readArray(ShardStats::new, ShardStats[]::new); if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_1_0)) { - indexHealthMap = in.readMap(StreamInput::readString, ClusterHealthStatus::readFrom); - indexStateMap = in.readMap(StreamInput::readString, IndexMetadata.State::readFrom); + indexHealthMap = in.readMap(ClusterHealthStatus::readFrom); + indexStateMap = in.readMap(IndexMetadata.State::readFrom); } else { indexHealthMap = Map.of(); indexStateMap = Map.of(); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetComponentTemplateAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetComponentTemplateAction.java index 20d6f7f339765..b1a55fcea58e6 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetComponentTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetComponentTemplateAction.java @@ -120,7 +120,7 @@ public static class Response extends ActionResponse implements ToXContentObject public Response(StreamInput in) throws IOException { super(in); - componentTemplates = in.readMap(StreamInput::readString, ComponentTemplate::new); + componentTemplates = in.readMap(ComponentTemplate::new); if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_007)) { rolloverConfiguration = in.readOptionalWriteable(RolloverConfiguration::new); } else { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetComposableIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetComposableIndexTemplateAction.java index d35eddb755fdc..481ff97781398 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetComposableIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetComposableIndexTemplateAction.java @@ -122,7 +122,7 @@ public static class Response extends ActionResponse implements ToXContentObject public Response(StreamInput in) throws IOException { super(in); - indexTemplates = in.readMap(StreamInput::readString, ComposableIndexTemplate::new); + indexTemplates = in.readMap(ComposableIndexTemplate::new); if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_007)) { rolloverConfiguration = in.readOptionalWriteable(RolloverConfiguration::new); } else { diff --git a/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilities.java b/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilities.java index daa9ee30bf9aa..c3363e5c812cc 100644 --- a/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilities.java +++ b/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilities.java @@ -244,7 +244,7 @@ public FieldCapabilities( this.nonDimensionIndices = null; this.metricConflictsIndices = null; } - meta = in.readMap(StreamInput::readString, i -> i.readSet(StreamInput::readString)); + meta = in.readMap(i -> i.readSet(StreamInput::readString)); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilitiesIndexResponse.java b/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilitiesIndexResponse.java index 57183c49cdef2..8c2ea2679ac4b 100644 --- a/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilitiesIndexResponse.java +++ b/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilitiesIndexResponse.java @@ -47,7 +47,7 @@ final class FieldCapabilitiesIndexResponse implements Writeable { FieldCapabilitiesIndexResponse(StreamInput in) throws IOException { this.indexName = in.readString(); - this.responseMap = in.readMap(StreamInput::readString, IndexFieldCapabilities::new); + this.responseMap = in.readMap(IndexFieldCapabilities::new); this.canMatch = in.readBoolean(); this.originVersion = in.getTransportVersion(); if (in.getTransportVersion().onOrAfter(MAPPING_HASH_VERSION)) { @@ -71,7 +71,7 @@ private record GroupByMappingHash(List indices, String indexMappingHash, implements Writeable { GroupByMappingHash(StreamInput in) throws IOException { - this(in.readStringList(), in.readString(), in.readMap(StreamInput::readString, IndexFieldCapabilities::new)); + this(in.readStringList(), in.readString(), in.readMap(IndexFieldCapabilities::new)); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilitiesResponse.java b/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilitiesResponse.java index 44ab201eb3681..ea6fb326a2b1e 100644 --- a/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilitiesResponse.java +++ b/server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilitiesResponse.java @@ -76,7 +76,7 @@ private FieldCapabilitiesResponse( public FieldCapabilitiesResponse(StreamInput in) throws IOException { super(in); indices = in.readStringArray(); - this.responseMap = in.readMap(StreamInput::readString, FieldCapabilitiesResponse::readField); + this.responseMap = in.readMap(FieldCapabilitiesResponse::readField); this.indexResponses = FieldCapabilitiesIndexResponse.readList(in); this.failures = in.readList(FieldCapabilitiesFailure::new); } @@ -136,7 +136,7 @@ public boolean isMetadataField(String field) { } private static Map readField(StreamInput in) throws IOException { - return in.readMap(StreamInput::readString, FieldCapabilities::new); + return in.readMap(FieldCapabilities::new); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/fieldcaps/IndexFieldCapabilities.java b/server/src/main/java/org/elasticsearch/action/fieldcaps/IndexFieldCapabilities.java index 9b3b7cd08c6cc..5b9ac325d1cf0 100644 --- a/server/src/main/java/org/elasticsearch/action/fieldcaps/IndexFieldCapabilities.java +++ b/server/src/main/java/org/elasticsearch/action/fieldcaps/IndexFieldCapabilities.java @@ -75,7 +75,7 @@ public class IndexFieldCapabilities implements Writeable { this.isDimension = false; this.metricType = null; } - this.meta = in.readMap(StreamInput::readString, StreamInput::readString); + this.meta = in.readMap(StreamInput::readString); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java index 9ac18519e30a2..d179ffdd242b4 100644 --- a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java @@ -159,7 +159,7 @@ public IndexRequest(@Nullable ShardId shardId, StreamInput in) throws IOExceptio requireAlias = false; } if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_13_0)) { - dynamicTemplates = in.readMap(StreamInput::readString, StreamInput::readString); + dynamicTemplates = in.readMap(StreamInput::readString); } } diff --git a/server/src/main/java/org/elasticsearch/action/search/SearchContextId.java b/server/src/main/java/org/elasticsearch/action/search/SearchContextId.java index 7e809a11ea1d0..4fb90cb871d21 100644 --- a/server/src/main/java/org/elasticsearch/action/search/SearchContextId.java +++ b/server/src/main/java/org/elasticsearch/action/search/SearchContextId.java @@ -93,7 +93,7 @@ public static SearchContextId decode(NamedWriteableRegistry namedWriteableRegist final TransportVersion version = TransportVersion.readVersion(in); in.setTransportVersion(version); final Map shards = in.readMap(ShardId::new, SearchContextIdForNode::new); - final Map aliasFilters = in.readMap(StreamInput::readString, AliasFilter::readFrom); + final Map aliasFilters = in.readMap(AliasFilter::readFrom); if (in.available() > 0) { throw new IllegalArgumentException("Not all bytes were read"); } diff --git a/server/src/main/java/org/elasticsearch/action/search/SearchRequest.java b/server/src/main/java/org/elasticsearch/action/search/SearchRequest.java index 36c41aa1ed334..aff813b6a5373 100644 --- a/server/src/main/java/org/elasticsearch/action/search/SearchRequest.java +++ b/server/src/main/java/org/elasticsearch/action/search/SearchRequest.java @@ -268,7 +268,7 @@ public SearchRequest(StreamInput in) throws IOException { minCompatibleShardNode = null; } if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_16_0)) { - waitForCheckpoints = in.readMap(StreamInput::readString, StreamInput::readLongArray); + waitForCheckpoints = in.readMap(StreamInput::readLongArray); waitForCheckpointsTimeout = in.readTimeValue(); } if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_4_0)) { diff --git a/server/src/main/java/org/elasticsearch/action/search/SearchShardsResponse.java b/server/src/main/java/org/elasticsearch/action/search/SearchShardsResponse.java index e70e0677e0e5f..5f34d40e2efb3 100644 --- a/server/src/main/java/org/elasticsearch/action/search/SearchShardsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/search/SearchShardsResponse.java @@ -49,7 +49,7 @@ public SearchShardsResponse(StreamInput in) throws IOException { super(in); this.groups = in.readList(SearchShardsGroup::new); this.nodes = in.readList(DiscoveryNode::new); - this.aliasFilters = in.readMap(StreamInput::readString, AliasFilter::readFrom); + this.aliasFilters = in.readMap(AliasFilter::readFrom); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsFields.java b/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsFields.java index 5e2d3c22a79fa..805bd055c97d7 100644 --- a/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsFields.java +++ b/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsFields.java @@ -131,7 +131,7 @@ public TermVectorsFields(BytesReference headerRef, BytesReference termVectors) t hasTermStatistic = header.readBoolean(); hasFieldStatistic = header.readBoolean(); hasScores = header.readBoolean(); - fieldMap = header.readMap(StreamInput::readString, StreamInput::readVLong); + fieldMap = header.readMap(StreamInput::readVLong); } // reference to the term vector data this.termVectors = termVectors; diff --git a/server/src/main/java/org/elasticsearch/cluster/ClusterInfo.java b/server/src/main/java/org/elasticsearch/cluster/ClusterInfo.java index 6b9e0f85f145b..7fc85f64fee8e 100644 --- a/server/src/main/java/org/elasticsearch/cluster/ClusterInfo.java +++ b/server/src/main/java/org/elasticsearch/cluster/ClusterInfo.java @@ -84,9 +84,9 @@ public ClusterInfo( } public ClusterInfo(StreamInput in) throws IOException { - this.leastAvailableSpaceUsage = in.readImmutableMap(StreamInput::readString, DiskUsage::new); - this.mostAvailableSpaceUsage = in.readImmutableMap(StreamInput::readString, DiskUsage::new); - this.shardSizes = in.readImmutableMap(StreamInput::readString, StreamInput::readLong); + this.leastAvailableSpaceUsage = in.readImmutableMap(DiskUsage::new); + this.mostAvailableSpaceUsage = in.readImmutableMap(DiskUsage::new); + this.shardSizes = in.readImmutableMap(StreamInput::readLong); this.shardDataSetSizes = in.getTransportVersion().onOrAfter(DATA_SET_SIZE_SIZE_VERSION) ? in.readImmutableMap(ShardId::new, StreamInput::readLong) : Map.of(); diff --git a/server/src/main/java/org/elasticsearch/cluster/ClusterState.java b/server/src/main/java/org/elasticsearch/cluster/ClusterState.java index e466aa0d69a23..c5a72f97ea940 100644 --- a/server/src/main/java/org/elasticsearch/cluster/ClusterState.java +++ b/server/src/main/java/org/elasticsearch/cluster/ClusterState.java @@ -908,7 +908,7 @@ public static ClusterState readFrom(StreamInput in, DiscoveryNode localNode) thr builder.routingTable = RoutingTable.readFrom(in); builder.nodes = DiscoveryNodes.readFrom(in, localNode); if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_8_0)) { - builder.transportVersions(in.readMap(StreamInput::readString, TransportVersion::readVersion)); + builder.transportVersions(in.readMap(TransportVersion::readVersion)); } else { // this clusterstate is from a pre-8.8.0 node // infer the versions from discoverynodes for now diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java index be82c8955a183..50bc9479ee540 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java @@ -206,7 +206,7 @@ public ClusterFormationState(StreamInput in) throws IOException { this( in.readStringList(), new DiscoveryNode(in), - in.readMap(StreamInput::readString, DiscoveryNode::new), + in.readMap(DiscoveryNode::new), in.readLong(), in.readLong(), new VotingConfiguration(in), diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationDiagnosticsService.java b/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationDiagnosticsService.java index 8d7a706ed53ed..ca4fb9f07fc75 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationDiagnosticsService.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationDiagnosticsService.java @@ -1291,7 +1291,7 @@ private static List readRecentMasters(StreamInput in) throws IOEx private static Map readClusterFormationStates(StreamInput in) throws IOException { if (in.readBoolean()) { - return in.readMap(StreamInput::readString, StreamInput::readString); + return in.readMap(StreamInput::readString); } else { return Map.of(); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplateMetadata.java b/server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplateMetadata.java index 26548f7b824ca..67582a5e27559 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplateMetadata.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplateMetadata.java @@ -59,7 +59,7 @@ public ComponentTemplateMetadata(Map componentTemplat } public ComponentTemplateMetadata(StreamInput in) throws IOException { - this.componentTemplates = in.readMap(StreamInput::readString, ComponentTemplate::new); + this.componentTemplates = in.readMap(ComponentTemplate::new); } public Map componentTemplates() { diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplateMetadata.java b/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplateMetadata.java index 53c73c7906b94..6da5bf26e427f 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplateMetadata.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplateMetadata.java @@ -60,7 +60,7 @@ public ComposableIndexTemplateMetadata(Map temp } public ComposableIndexTemplateMetadata(StreamInput in) throws IOException { - this.indexTemplates = in.readMap(StreamInput::readString, ComposableIndexTemplate::new); + this.indexTemplates = in.readMap(ComposableIndexTemplate::new); } public static ComposableIndexTemplateMetadata fromXContent(XContentParser parser) throws IOException { diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamAlias.java b/server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamAlias.java index 7efba02dfe341..be8613f5790ba 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamAlias.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamAlias.java @@ -168,7 +168,7 @@ public DataStreamAlias(StreamInput in) throws IOException { this.dataStreams = in.readStringList(); this.writeDataStream = in.readOptionalString(); if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_7_0)) { - this.dataStreamToFilterMap = in.readMap(StreamInput::readString, CompressedXContent::readCompressedString); + this.dataStreamToFilterMap = in.readMap(CompressedXContent::readCompressedString); } else { this.dataStreamToFilterMap = new HashMap<>(); CompressedXContent filter = in.readBoolean() ? CompressedXContent.readCompressedString(in) : null; diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/DiffableStringMap.java b/server/src/main/java/org/elasticsearch/cluster/metadata/DiffableStringMap.java index 1859616865dda..a26bf8189117e 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/DiffableStringMap.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/DiffableStringMap.java @@ -89,7 +89,7 @@ public Diff diff(DiffableStringMap previousState) { public static Diff readDiffFrom(StreamInput in) throws IOException { final List deletes = in.readStringList(); - final Map upserts = in.readMap(StreamInput::readString, StreamInput::readString); + final Map upserts = in.readMap(StreamInput::readString); return getDiff(deletes, upserts); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/NodesShutdownMetadata.java b/server/src/main/java/org/elasticsearch/cluster/metadata/NodesShutdownMetadata.java index 5222eb1605591..a5207adb20b01 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/NodesShutdownMetadata.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/NodesShutdownMetadata.java @@ -74,7 +74,7 @@ public NodesShutdownMetadata(Map nodes) { } public NodesShutdownMetadata(StreamInput in) throws IOException { - this(in.readImmutableMap(StreamInput::readString, SingleNodeShutdownMetadata::new)); + this(in.readImmutableMap(SingleNodeShutdownMetadata::new)); } @Override diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/Template.java b/server/src/main/java/org/elasticsearch/cluster/metadata/Template.java index 6b4e003ce7f49..0b6ca729f98cc 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/Template.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/Template.java @@ -145,7 +145,7 @@ public Template(StreamInput in) throws IOException { this.mappings = null; } if (in.readBoolean()) { - this.aliases = in.readMap(StreamInput::readString, AliasMetadata::new); + this.aliases = in.readMap(AliasMetadata::new); } else { this.aliases = null; } diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/ClusterBalanceStats.java b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/ClusterBalanceStats.java index 8076d48775ae5..56a42cff10fbb 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/ClusterBalanceStats.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/ClusterBalanceStats.java @@ -60,10 +60,7 @@ public static ClusterBalanceStats createFrom( } public static ClusterBalanceStats readFrom(StreamInput in) throws IOException { - return new ClusterBalanceStats( - in.readImmutableMap(StreamInput::readString, TierBalanceStats::readFrom), - in.readImmutableMap(StreamInput::readString, NodeBalanceStats::readFrom) - ); + return new ClusterBalanceStats(in.readImmutableMap(TierBalanceStats::readFrom), in.readImmutableMap(NodeBalanceStats::readFrom)); } @Override diff --git a/server/src/main/java/org/elasticsearch/common/FieldMemoryStats.java b/server/src/main/java/org/elasticsearch/common/FieldMemoryStats.java index 6f0f69e9e6504..1785ca96c4ab3 100644 --- a/server/src/main/java/org/elasticsearch/common/FieldMemoryStats.java +++ b/server/src/main/java/org/elasticsearch/common/FieldMemoryStats.java @@ -39,7 +39,7 @@ public FieldMemoryStats(Map stats) { * Creates a new FieldMemoryStats instance from a stream */ public FieldMemoryStats(StreamInput input) throws IOException { - stats = input.readMap(StreamInput::readString, StreamInput::readVLong); + stats = input.readMap(StreamInput::readVLong); } /** diff --git a/server/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java b/server/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java index 9ea8bc127dd57..6b43e59177cde 100644 --- a/server/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java +++ b/server/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java @@ -618,6 +618,13 @@ public byte[] readOptionalByteArray() throws IOException { return null; } + /** + * Same as {@link #readMap(Writeable.Reader, Writeable.Reader)} but always reading string keys. + */ + public Map readMap(Writeable.Reader valueReader) throws IOException { + return readMap(StreamInput::readString, valueReader, Maps::newHashMapWithExpectedSize); + } + /** * If the returned map contains any entries it will be mutable. If it is empty it might be immutable. */ @@ -645,28 +652,18 @@ private Map readMap(Writeable.Reader keyReader, Writeable.Reader } /** - * Read a {@link Map} of {@code K}-type keys to {@code V}-type {@link List}s. + * Read a {@link Map} of string keys to {@code V}-type {@link List}s. *

-     * Map<String, List<String>> map = in.readMapOfLists(StreamInput::readString, StreamInput::readString);
+     * Map<String, List<String>> map = in.readMapOfLists(StreamInput::readString);
      * 
* If the map or a list in it contains any elements it will be mutable, otherwise either the empty map or empty lists it contains * might be immutable. * - * @param keyReader The key reader * @param valueReader The value reader * @return Never {@code null}. */ - public Map> readMapOfLists(final Writeable.Reader keyReader, final Writeable.Reader valueReader) - throws IOException { - final int size = readArraySize(); - if (size == 0) { - return Collections.emptyMap(); - } - final Map> map = Maps.newMapWithExpectedSize(size); - for (int i = 0; i < size; ++i) { - map.put(keyReader.read(this), readList(valueReader)); - } - return map; + public Map> readMapOfLists(final Writeable.Reader valueReader) throws IOException { + return readMap(i -> i.readList(valueReader)); } /** @@ -698,6 +695,13 @@ public Map readMap() throws IOException { return (Map) readGenericValue(); } + /** + * Same as {@link #readMap(Writeable.Reader, Writeable.Reader)} but always reading string keys. + */ + public Map readImmutableMap(Writeable.Reader valueReader) throws IOException { + return readImmutableMap(StreamInput::readString, valueReader); + } + /** * Read a {@link Map} using the given key and value readers. The return Map is immutable. * @@ -762,7 +766,7 @@ public Object readGenericValue() throws IOException { : readOrderedMap(StreamInput::readString, StreamInput::readGenericValue); case 10 -> getTransportVersion().onOrAfter(TransportVersion.V_8_7_0) ? readMap(StreamInput::readGenericValue, StreamInput::readGenericValue) - : readMap(StreamInput::readString, StreamInput::readGenericValue); + : readMap(StreamInput::readGenericValue); case 11 -> readByte(); case 12 -> readDate(); case 13 -> diff --git a/server/src/main/java/org/elasticsearch/common/settings/KeyStoreWrapper.java b/server/src/main/java/org/elasticsearch/common/settings/KeyStoreWrapper.java index 20cc210dd78f4..4a00cc1250461 100644 --- a/server/src/main/java/org/elasticsearch/common/settings/KeyStoreWrapper.java +++ b/server/src/main/java/org/elasticsearch/common/settings/KeyStoreWrapper.java @@ -179,7 +179,7 @@ public KeyStoreWrapper(StreamInput input) throws IOException { formatVersion = input.readInt(); hasPassword = input.readBoolean(); dataBytes = input.readOptionalByteArray(); - entries.set(input.readMap(StreamInput::readString, Entry::new)); + entries.set(input.readMap(Entry::new)); closed = input.readBoolean(); } diff --git a/server/src/main/java/org/elasticsearch/common/settings/LocallyMountedSecrets.java b/server/src/main/java/org/elasticsearch/common/settings/LocallyMountedSecrets.java index 05801af60027a..ddbf5ec2bbc96 100644 --- a/server/src/main/java/org/elasticsearch/common/settings/LocallyMountedSecrets.java +++ b/server/src/main/java/org/elasticsearch/common/settings/LocallyMountedSecrets.java @@ -252,7 +252,7 @@ record LocalFileSecrets(Map entries, ReservedStateVersion metada */ public static LocalFileSecrets readFrom(StreamInput in) throws IOException { assert in.getTransportVersion() == TransportVersion.current(); - return new LocalFileSecrets(in.readMap(StreamInput::readString, StreamInput::readByteArray), ReservedStateVersion.readFrom(in)); + return new LocalFileSecrets(in.readMap(StreamInput::readByteArray), ReservedStateVersion.readFrom(in)); } /** diff --git a/server/src/main/java/org/elasticsearch/common/util/concurrent/ThreadContext.java b/server/src/main/java/org/elasticsearch/common/util/concurrent/ThreadContext.java index 7678d3f7d10ab..551af04e1956f 100644 --- a/server/src/main/java/org/elasticsearch/common/util/concurrent/ThreadContext.java +++ b/server/src/main/java/org/elasticsearch/common/util/concurrent/ThreadContext.java @@ -463,8 +463,8 @@ public void setHeaders(Tuple, Map>> head } public static Tuple, Map>> readHeadersFromStream(StreamInput in) throws IOException { - final Map requestHeaders = in.readMap(StreamInput::readString, StreamInput::readString); - final Map> responseHeaders = in.readMap(StreamInput::readString, input -> { + final Map requestHeaders = in.readMap(StreamInput::readString); + final Map> responseHeaders = in.readMap(input -> { final int size = input.readVInt(); if (size == 0) { return Collections.emptySet(); diff --git a/server/src/main/java/org/elasticsearch/health/node/HealthInfo.java b/server/src/main/java/org/elasticsearch/health/node/HealthInfo.java index d87609a904157..f83d5916a792e 100644 --- a/server/src/main/java/org/elasticsearch/health/node/HealthInfo.java +++ b/server/src/main/java/org/elasticsearch/health/node/HealthInfo.java @@ -23,7 +23,7 @@ public record HealthInfo(Map diskInfoByNode) implements public static final HealthInfo EMPTY_HEALTH_INFO = new HealthInfo(Map.of()); public HealthInfo(StreamInput input) throws IOException { - this(input.readMap(StreamInput::readString, DiskHealthInfo::new)); + this(input.readMap(DiskHealthInfo::new)); } @Override diff --git a/server/src/main/java/org/elasticsearch/index/engine/CommitStats.java b/server/src/main/java/org/elasticsearch/index/engine/CommitStats.java index d93c71be1cb15..1a44f1f46c33e 100644 --- a/server/src/main/java/org/elasticsearch/index/engine/CommitStats.java +++ b/server/src/main/java/org/elasticsearch/index/engine/CommitStats.java @@ -38,7 +38,7 @@ public CommitStats(SegmentInfos segmentInfos) { } CommitStats(StreamInput in) throws IOException { - userData = in.readImmutableMap(StreamInput::readString, StreamInput::readString); + userData = in.readImmutableMap(StreamInput::readString); generation = in.readLong(); id = in.readOptionalString(); numDocs = in.readInt(); diff --git a/server/src/main/java/org/elasticsearch/index/engine/Segment.java b/server/src/main/java/org/elasticsearch/index/engine/Segment.java index 88dbe7d454a3d..acfb1ac8920a1 100644 --- a/server/src/main/java/org/elasticsearch/index/engine/Segment.java +++ b/server/src/main/java/org/elasticsearch/index/engine/Segment.java @@ -60,7 +60,7 @@ public Segment(StreamInput in) throws IOException { } segmentSort = readSegmentSort(in); if (in.readBoolean()) { - attributes = in.readMap(StreamInput::readString, StreamInput::readString); + attributes = in.readMap(StreamInput::readString); } else { attributes = null; } diff --git a/server/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java b/server/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java index 5b21bcbfd599f..07b92f97aa8ae 100644 --- a/server/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java +++ b/server/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java @@ -52,7 +52,6 @@ public FieldDataStats(StreamInput in) throws IOException { Map fieldGlobalOrdinalsStats = null; if (in.readBoolean()) { fieldGlobalOrdinalsStats = in.readMap( - StreamInput::readString, in1 -> new GlobalOrdinalsStats.GlobalOrdinalFieldStats(in1.readVLong(), in1.readVLong()) ); } diff --git a/server/src/main/java/org/elasticsearch/index/search/stats/FieldUsageStats.java b/server/src/main/java/org/elasticsearch/index/search/stats/FieldUsageStats.java index 93d047a87c4da..1a0be7523ba08 100644 --- a/server/src/main/java/org/elasticsearch/index/search/stats/FieldUsageStats.java +++ b/server/src/main/java/org/elasticsearch/index/search/stats/FieldUsageStats.java @@ -52,7 +52,7 @@ public FieldUsageStats(Map stats) { } public FieldUsageStats(StreamInput in) throws IOException { - stats = in.readMap(StreamInput::readString, PerFieldUsageStats::new); + stats = in.readMap(PerFieldUsageStats::new); } @Override diff --git a/server/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java b/server/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java index ca0932f2107da..22fdf8ecd2bc3 100644 --- a/server/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java +++ b/server/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java @@ -297,7 +297,7 @@ public SearchStats(StreamInput in) throws IOException { totalStats = Stats.readStats(in); openContexts = in.readVLong(); if (in.readBoolean()) { - groupStats = in.readMap(StreamInput::readString, Stats::readStats); + groupStats = in.readMap(Stats::readStats); } } diff --git a/server/src/main/java/org/elasticsearch/index/seqno/ReplicationTracker.java b/server/src/main/java/org/elasticsearch/index/seqno/ReplicationTracker.java index 333a1b177b965..1dd23f0b0a15e 100644 --- a/server/src/main/java/org/elasticsearch/index/seqno/ReplicationTracker.java +++ b/server/src/main/java/org/elasticsearch/index/seqno/ReplicationTracker.java @@ -1583,7 +1583,7 @@ public PrimaryContext(long clusterStateVersion, Map che public PrimaryContext(StreamInput in) throws IOException { clusterStateVersion = in.readVLong(); - checkpoints = in.readMap(StreamInput::readString, CheckpointState::new); + checkpoints = in.readMap(CheckpointState::new); routingTable = IndexShardRoutingTable.Builder.readFrom(in).build(); } diff --git a/server/src/main/java/org/elasticsearch/index/shard/IndexingStats.java b/server/src/main/java/org/elasticsearch/index/shard/IndexingStats.java index f416178a6b10d..22f3da92eebaf 100644 --- a/server/src/main/java/org/elasticsearch/index/shard/IndexingStats.java +++ b/server/src/main/java/org/elasticsearch/index/shard/IndexingStats.java @@ -270,7 +270,7 @@ public IndexingStats(StreamInput in) throws IOException { totalStats = new Stats(in); if (in.getTransportVersion().before(TransportVersion.V_8_0_0)) { if (in.readBoolean()) { - Map typeStats = in.readMap(StreamInput::readString, Stats::new); + Map typeStats = in.readMap(Stats::new); assert typeStats.size() == 1; assert typeStats.containsKey(MapperService.SINGLE_MAPPING_NAME); } diff --git a/server/src/main/java/org/elasticsearch/index/store/Store.java b/server/src/main/java/org/elasticsearch/index/store/Store.java index b70683ee1f775..74e1bc88a3b82 100644 --- a/server/src/main/java/org/elasticsearch/index/store/Store.java +++ b/server/src/main/java/org/elasticsearch/index/store/Store.java @@ -860,7 +860,7 @@ static MetadataSnapshot loadFromIndexCommit(IndexCommit commit, Directory direct public static MetadataSnapshot readFrom(StreamInput in) throws IOException { final Map metadata = in.readMapValues(StoreFileMetadata::new, StoreFileMetadata::name); - final var commitUserData = in.readMap(StreamInput::readString, StreamInput::readString); + final var commitUserData = in.readMap(StreamInput::readString); final var numDocs = in.readLong(); if (metadata.size() == 0 && commitUserData.size() == 0 && numDocs == 0) { diff --git a/server/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java b/server/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java index f928f83531aa0..d4a15bea858e3 100644 --- a/server/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java +++ b/server/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java @@ -280,7 +280,7 @@ public JvmInfo(StreamInput in) throws IOException { } bootClassPath = in.readString(); classPath = in.readString(); - systemProperties = in.readMap(StreamInput::readString, StreamInput::readString); + systemProperties = in.readMap(StreamInput::readString); mem = new Mem(in); gcCollectors = in.readStringArray(); memoryPools = in.readStringArray(); diff --git a/server/src/main/java/org/elasticsearch/node/AdaptiveSelectionStats.java b/server/src/main/java/org/elasticsearch/node/AdaptiveSelectionStats.java index 833cec370ff6f..0f54d7ce43b61 100644 --- a/server/src/main/java/org/elasticsearch/node/AdaptiveSelectionStats.java +++ b/server/src/main/java/org/elasticsearch/node/AdaptiveSelectionStats.java @@ -42,8 +42,8 @@ public AdaptiveSelectionStats( } public AdaptiveSelectionStats(StreamInput in) throws IOException { - this.clientOutgoingConnections = in.readMap(StreamInput::readString, StreamInput::readLong); - this.nodeComputedStats = in.readMap(StreamInput::readString, ResponseCollectorService.ComputedNodeStats::new); + this.clientOutgoingConnections = in.readMap(StreamInput::readLong); + this.nodeComputedStats = in.readMap(ResponseCollectorService.ComputedNodeStats::new); } @Override diff --git a/server/src/main/java/org/elasticsearch/persistent/PersistentTasksCustomMetadata.java b/server/src/main/java/org/elasticsearch/persistent/PersistentTasksCustomMetadata.java index 9a3adb06ae296..1ce3ab6633faf 100644 --- a/server/src/main/java/org/elasticsearch/persistent/PersistentTasksCustomMetadata.java +++ b/server/src/main/java/org/elasticsearch/persistent/PersistentTasksCustomMetadata.java @@ -532,7 +532,7 @@ public String getWriteableName() { public PersistentTasksCustomMetadata(StreamInput in) throws IOException { lastAllocationId = in.readLong(); - tasks = in.readMap(StreamInput::readString, PersistentTask::new); + tasks = in.readMap(PersistentTask::new); } @Override diff --git a/server/src/main/java/org/elasticsearch/repositories/RepositoriesStats.java b/server/src/main/java/org/elasticsearch/repositories/RepositoriesStats.java index 5e4f3fd39cad9..6a13053ec9279 100644 --- a/server/src/main/java/org/elasticsearch/repositories/RepositoriesStats.java +++ b/server/src/main/java/org/elasticsearch/repositories/RepositoriesStats.java @@ -29,7 +29,7 @@ public class RepositoriesStats implements Writeable, ToXContentFragment { public RepositoriesStats(StreamInput in) throws IOException { if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_011)) { - repositoryThrottlingStats = in.readMap(StreamInput::readString, ThrottlingStats::new); + repositoryThrottlingStats = in.readMap(ThrottlingStats::new); } else { repositoryThrottlingStats = new HashMap<>(); } diff --git a/server/src/main/java/org/elasticsearch/repositories/RepositoryInfo.java b/server/src/main/java/org/elasticsearch/repositories/RepositoryInfo.java index 040d02acfcc8a..fe3251a10d7fb 100644 --- a/server/src/main/java/org/elasticsearch/repositories/RepositoryInfo.java +++ b/server/src/main/java/org/elasticsearch/repositories/RepositoryInfo.java @@ -56,7 +56,7 @@ public RepositoryInfo(StreamInput in) throws IOException { this.ephemeralId = in.readString(); this.name = in.readString(); this.type = in.readString(); - this.location = in.readMap(StreamInput::readString, StreamInput::readString); + this.location = in.readMap(StreamInput::readString); this.startedAt = in.readLong(); this.stoppedAt = in.readOptionalLong(); } diff --git a/server/src/main/java/org/elasticsearch/repositories/RepositoryStats.java b/server/src/main/java/org/elasticsearch/repositories/RepositoryStats.java index aee9d7c7cced2..b991b3954edfc 100644 --- a/server/src/main/java/org/elasticsearch/repositories/RepositoryStats.java +++ b/server/src/main/java/org/elasticsearch/repositories/RepositoryStats.java @@ -29,7 +29,7 @@ public RepositoryStats(Map requestCounts) { } public RepositoryStats(StreamInput in) throws IOException { - this.requestCounts = in.readMap(StreamInput::readString, StreamInput::readLong); + this.requestCounts = in.readMap(StreamInput::readLong); } public RepositoryStats merge(RepositoryStats otherStats) { diff --git a/server/src/main/java/org/elasticsearch/script/ScriptLanguagesInfo.java b/server/src/main/java/org/elasticsearch/script/ScriptLanguagesInfo.java index 4e26fed09c94e..8993188c36c24 100644 --- a/server/src/main/java/org/elasticsearch/script/ScriptLanguagesInfo.java +++ b/server/src/main/java/org/elasticsearch/script/ScriptLanguagesInfo.java @@ -83,7 +83,7 @@ public ScriptLanguagesInfo(Set typesAllowed, Map> la public ScriptLanguagesInfo(StreamInput in) throws IOException { typesAllowed = in.readImmutableSet(StreamInput::readString); - languageContexts = in.readImmutableMap(StreamInput::readString, sin -> sin.readImmutableSet(StreamInput::readString)); + languageContexts = in.readImmutableMap(sin -> sin.readImmutableSet(StreamInput::readString)); } @SuppressWarnings("unchecked") diff --git a/server/src/main/java/org/elasticsearch/search/SearchHit.java b/server/src/main/java/org/elasticsearch/search/SearchHit.java index 35e8813351847..3383227a5b949 100644 --- a/server/src/main/java/org/elasticsearch/search/SearchHit.java +++ b/server/src/main/java/org/elasticsearch/search/SearchHit.java @@ -157,8 +157,8 @@ public SearchHit(StreamInput in) throws IOException { explanation = readExplanation(in); } if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_8_0)) { - documentFields.putAll(in.readMap(StreamInput::readString, DocumentField::new)); - metaFields.putAll(in.readMap(StreamInput::readString, DocumentField::new)); + documentFields.putAll(in.readMap(DocumentField::new)); + metaFields.putAll(in.readMap(DocumentField::new)); } else { Map fields = readFields(in); fields.forEach( diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/support/MultiValuesSourceAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/support/MultiValuesSourceAggregationBuilder.java index b5b5d260e1651..42d1fc745392f 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/support/MultiValuesSourceAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/support/MultiValuesSourceAggregationBuilder.java @@ -97,7 +97,7 @@ protected MultiValuesSourceAggregationBuilder(StreamInput in) throws IOException */ @SuppressWarnings("unchecked") private void read(StreamInput in) throws IOException { - fields = in.readMap(StreamInput::readString, MultiValuesSourceFieldConfig::new); + fields = in.readMap(MultiValuesSourceFieldConfig::new); userValueTypeHint = in.readOptionalWriteable(ValueType::readFromStream); format = in.readOptionalString(); } diff --git a/server/src/main/java/org/elasticsearch/search/profile/ProfileResult.java b/server/src/main/java/org/elasticsearch/search/profile/ProfileResult.java index 0fb8c13b14c4e..e34cc1a1bcd77 100644 --- a/server/src/main/java/org/elasticsearch/search/profile/ProfileResult.java +++ b/server/src/main/java/org/elasticsearch/search/profile/ProfileResult.java @@ -74,9 +74,9 @@ public ProfileResult(StreamInput in) throws IOException { this.type = in.readString(); this.description = in.readString(); this.nodeTime = in.readLong(); - breakdown = in.readMap(StreamInput::readString, StreamInput::readLong); + breakdown = in.readMap(StreamInput::readLong); if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_9_0)) { - debug = in.readMap(StreamInput::readString, StreamInput::readGenericValue); + debug = in.readMap(StreamInput::readGenericValue); } else { debug = Map.of(); } diff --git a/server/src/main/java/org/elasticsearch/search/profile/SearchProfileResults.java b/server/src/main/java/org/elasticsearch/search/profile/SearchProfileResults.java index 40a251ab24b8d..c993edb5b1dd5 100644 --- a/server/src/main/java/org/elasticsearch/search/profile/SearchProfileResults.java +++ b/server/src/main/java/org/elasticsearch/search/profile/SearchProfileResults.java @@ -46,13 +46,10 @@ public SearchProfileResults(Map shardResults) public SearchProfileResults(StreamInput in) throws IOException { if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_16_0)) { - shardResults = in.readMap(StreamInput::readString, SearchProfileShardResult::new); + shardResults = in.readMap(SearchProfileShardResult::new); } else { // Before 8.0.0 we only send the query phase result - shardResults = in.readMap( - StreamInput::readString, - i -> new SearchProfileShardResult(new SearchProfileQueryPhaseResult(i), null) - ); + shardResults = in.readMap(i -> new SearchProfileShardResult(new SearchProfileQueryPhaseResult(i), null)); } } diff --git a/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java b/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java index 4061b79118bef..c16ddd831f78c 100644 --- a/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java +++ b/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java @@ -515,10 +515,7 @@ public static SnapshotInfo readFrom(final StreamInput in) throws IOException { final Map userMetadata = in.readMap(); final List dataStreams = in.readImmutableStringList(); final List featureStates = in.readImmutableList(SnapshotFeatureInfo::new); - final Map indexSnapshotDetails = in.readImmutableMap( - StreamInput::readString, - IndexSnapshotDetails::new - ); + final Map indexSnapshotDetails = in.readImmutableMap(IndexSnapshotDetails::new); return new SnapshotInfo( snapshot, indices, diff --git a/server/src/main/java/org/elasticsearch/tasks/TaskInfo.java b/server/src/main/java/org/elasticsearch/tasks/TaskInfo.java index 6fd3c1cb0e02e..953ca3b7c101f 100644 --- a/server/src/main/java/org/elasticsearch/tasks/TaskInfo.java +++ b/server/src/main/java/org/elasticsearch/tasks/TaskInfo.java @@ -72,7 +72,7 @@ public static TaskInfo from(StreamInput in) throws IOException { in.readBoolean(), in.readBoolean(), TaskId.readFromStream(in), - in.readMap(StreamInput::readString, StreamInput::readString) + in.readMap(StreamInput::readString) ); } diff --git a/server/src/main/java/org/elasticsearch/upgrades/FeatureMigrationResults.java b/server/src/main/java/org/elasticsearch/upgrades/FeatureMigrationResults.java index f6f5e7bbc3530..d6f31b6a89ef8 100644 --- a/server/src/main/java/org/elasticsearch/upgrades/FeatureMigrationResults.java +++ b/server/src/main/java/org/elasticsearch/upgrades/FeatureMigrationResults.java @@ -69,14 +69,14 @@ public FeatureMigrationResults(Map feature } public FeatureMigrationResults(StreamInput in) throws IOException { - this.featureStatuses = in.readMap(StreamInput::readString, SingleFeatureMigrationResult::new); + this.featureStatuses = in.readMap(SingleFeatureMigrationResult::new); } @Override public void writeTo(StreamOutput out) throws IOException { out.writeMap( featureStatuses, - (StreamOutput outStream, String featureName) -> outStream.writeString(featureName), + StreamOutput::writeString, (StreamOutput outStream, SingleFeatureMigrationResult featureStatus) -> featureStatus.writeTo(outStream) ); } diff --git a/server/src/test/java/org/elasticsearch/common/io/stream/BytesStreamsTests.java b/server/src/test/java/org/elasticsearch/common/io/stream/BytesStreamsTests.java index 749d8b3c95954..740f72ce02bd6 100644 --- a/server/src/test/java/org/elasticsearch/common/io/stream/BytesStreamsTests.java +++ b/server/src/test/java/org/elasticsearch/common/io/stream/BytesStreamsTests.java @@ -562,7 +562,7 @@ public void testWriteMapOfLists() throws IOException { final StreamInput in = StreamInput.wrap(BytesReference.toBytes(out.bytes())); - final Map> loaded = in.readMapOfLists(StreamInput::readString, StreamInput::readString); + final Map> loaded = in.readMapOfLists(StreamInput::readString); assertThat(loaded.size(), equalTo(expected.size())); diff --git a/server/src/test/java/org/elasticsearch/common/io/stream/RecyclerBytesStreamOutputTests.java b/server/src/test/java/org/elasticsearch/common/io/stream/RecyclerBytesStreamOutputTests.java index 9c7d8ecf16ff9..63fe28d7fc37b 100644 --- a/server/src/test/java/org/elasticsearch/common/io/stream/RecyclerBytesStreamOutputTests.java +++ b/server/src/test/java/org/elasticsearch/common/io/stream/RecyclerBytesStreamOutputTests.java @@ -602,7 +602,7 @@ public void testWriteMapOfLists() throws IOException { final StreamInput in = StreamInput.wrap(BytesReference.toBytes(out.bytes())); - final Map> loaded = in.readMapOfLists(StreamInput::readString, StreamInput::readString); + final Map> loaded = in.readMapOfLists(StreamInput::readString); assertThat(loaded.size(), equalTo(expected.size())); diff --git a/test/external-modules/seek-tracking-directory/src/main/java/org/elasticsearch/test/seektracker/NodeSeekStats.java b/test/external-modules/seek-tracking-directory/src/main/java/org/elasticsearch/test/seektracker/NodeSeekStats.java index 143ff2d344834..db743c1d976e1 100644 --- a/test/external-modules/seek-tracking-directory/src/main/java/org/elasticsearch/test/seektracker/NodeSeekStats.java +++ b/test/external-modules/seek-tracking-directory/src/main/java/org/elasticsearch/test/seektracker/NodeSeekStats.java @@ -31,7 +31,7 @@ public NodeSeekStats(DiscoveryNode node, Map> seeks public NodeSeekStats(StreamInput in) throws IOException { super(in); - this.seeks = in.readMap(StreamInput::readString, (s -> s.readList(ShardSeekStats::new))); + this.seeks = in.readMap(s -> s.readList(ShardSeekStats::new)); } @Override diff --git a/test/external-modules/seek-tracking-directory/src/main/java/org/elasticsearch/test/seektracker/ShardSeekStats.java b/test/external-modules/seek-tracking-directory/src/main/java/org/elasticsearch/test/seektracker/ShardSeekStats.java index 8cb290e56f7bf..702d648d1c34d 100644 --- a/test/external-modules/seek-tracking-directory/src/main/java/org/elasticsearch/test/seektracker/ShardSeekStats.java +++ b/test/external-modules/seek-tracking-directory/src/main/java/org/elasticsearch/test/seektracker/ShardSeekStats.java @@ -20,7 +20,7 @@ public record ShardSeekStats(String shard, Map seeksPerFile) implements Writeable, ToXContentObject { public ShardSeekStats(StreamInput in) throws IOException { - this(in.readString(), in.readMap(StreamInput::readString, StreamInput::readLong)); + this(in.readString(), in.readMap(StreamInput::readLong)); } @Override diff --git a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/stringstats/InternalStringStats.java b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/stringstats/InternalStringStats.java index a0c4ba5866702..f5c1fbbb83bf3 100644 --- a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/stringstats/InternalStringStats.java +++ b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/stringstats/InternalStringStats.java @@ -93,7 +93,7 @@ public InternalStringStats(StreamInput in) throws IOException { totalLength = in.readVLong(); minLength = in.readVInt(); maxLength = in.readVInt(); - charOccurrences = in.readMap(StreamInput::readString, StreamInput::readLong); + charOccurrences = in.readMap(StreamInput::readLong); } @Override diff --git a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/GetAutoscalingCapacityAction.java b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/GetAutoscalingCapacityAction.java index 0d34cd5da4f88..029729f9cad12 100644 --- a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/GetAutoscalingCapacityAction.java +++ b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/GetAutoscalingCapacityAction.java @@ -85,7 +85,7 @@ public Response(final SortedMap results) { public Response(final StreamInput in) throws IOException { super(in); - results = new TreeMap<>(in.readMap(StreamInput::readString, AutoscalingDeciderResults::new)); + results = new TreeMap<>(in.readMap(AutoscalingDeciderResults::new)); } @Override diff --git a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingDeciderResults.java b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingDeciderResults.java index ab4b9bebc125a..b45a38614a1b7 100644 --- a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingDeciderResults.java +++ b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingDeciderResults.java @@ -64,7 +64,7 @@ public AutoscalingDeciderResults(final StreamInput in) throws IOException { this.currentNodes = in.readSet(DiscoveryNode::new) .stream() .collect(Collectors.toCollection(() -> new TreeSet<>(DISCOVERY_NODE_COMPARATOR))); - this.results = new TreeMap<>(in.readMap(StreamInput::readString, AutoscalingDeciderResult::new)); + this.results = new TreeMap<>(in.readMap(AutoscalingDeciderResult::new)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/DataTiersFeatureSetUsage.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/DataTiersFeatureSetUsage.java index ec3d9f2631110..8ec138948f2f1 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/DataTiersFeatureSetUsage.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/DataTiersFeatureSetUsage.java @@ -32,7 +32,7 @@ public class DataTiersFeatureSetUsage extends XPackFeatureSet.Usage { public DataTiersFeatureSetUsage(StreamInput in) throws IOException { super(in); - this.tierStats = in.readMap(StreamInput::readString, TierSpecificStats::new); + this.tierStats = in.readMap(TierSpecificStats::new); } public DataTiersFeatureSetUsage(Map tierStats) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowMetadata.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowMetadata.java index deb46fc97db2e..822b3829a4e94 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowMetadata.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowMetadata.java @@ -106,9 +106,9 @@ public AutoFollowMetadata( public AutoFollowMetadata(StreamInput in) throws IOException { this( - in.readMap(StreamInput::readString, AutoFollowPattern::readFrom), - in.readMapOfLists(StreamInput::readString, StreamInput::readString), - in.readMap(StreamInput::readString, valIn -> valIn.readMap(StreamInput::readString, StreamInput::readString)) + in.readMap(AutoFollowPattern::readFrom), + in.readMapOfLists(StreamInput::readString), + in.readMap(valIn -> valIn.readMap(StreamInput::readString)) ); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowStats.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowStats.java index debf4dc65f78b..da83545d3a327 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowStats.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowStats.java @@ -124,10 +124,8 @@ public AutoFollowStats(StreamInput in) throws IOException { numberOfFailedFollowIndices = in.readVLong(); numberOfFailedRemoteClusterStateRequests = in.readVLong(); numberOfSuccessfulFollowIndices = in.readVLong(); - recentAutoFollowErrors = new TreeMap<>( - in.readMap(StreamInput::readString, in1 -> new Tuple<>(in1.readZLong(), in1.readException())) - ); - autoFollowedClusters = new TreeMap<>(in.readMap(StreamInput::readString, AutoFollowedCluster::new)); + recentAutoFollowErrors = new TreeMap<>(in.readMap(in1 -> new Tuple<>(in1.readZLong(), in1.readException()))); + autoFollowedClusters = new TreeMap<>(in.readMap(AutoFollowedCluster::new)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/GetAutoFollowPatternAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/GetAutoFollowPatternAction.java index ddab94431f29f..cfe46f8161b1f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/GetAutoFollowPatternAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/GetAutoFollowPatternAction.java @@ -88,7 +88,7 @@ public Map getAutoFollowPatterns() { public Response(StreamInput in) throws IOException { super(in); - autoFollowPatterns = in.readMap(StreamInput::readString, AutoFollowPattern::readFrom); + autoFollowPatterns = in.readMap(AutoFollowPattern::readFrom); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/ShardFollowTask.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/ShardFollowTask.java index fc0cb00e443d4..b1d6c5583afa2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/ShardFollowTask.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/ShardFollowTask.java @@ -122,7 +122,7 @@ private ShardFollowTask(String remoteCluster, ShardId followShardId, ShardId lea this.remoteCluster = remoteCluster; this.followShardId = followShardId; this.leaderShardId = leaderShardId; - this.headers = in.readImmutableMap(StreamInput::readString, StreamInput::readString); + this.headers = in.readImmutableMap(StreamInput::readString); } public String getRemoteCluster() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/enrich/EnrichMetadata.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/enrich/EnrichMetadata.java index 042f8a975da42..6908c4f9f72d6 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/enrich/EnrichMetadata.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/enrich/EnrichMetadata.java @@ -65,7 +65,7 @@ public static EnrichMetadata fromXContent(XContentParser parser) throws IOExcept private final Map policies; public EnrichMetadata(StreamInput in) throws IOException { - this(in.readMap(StreamInput::readString, EnrichPolicy::new)); + this(in.readMap(EnrichPolicy::new)); } public EnrichMetadata(Map policies) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleFeatureSetUsage.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleFeatureSetUsage.java index 882c1e91da026..19bc639a7e595 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleFeatureSetUsage.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleFeatureSetUsage.java @@ -105,7 +105,7 @@ public PolicyStats(Map phaseStats, int numberIndicesManaged) } public PolicyStats(StreamInput in) throws IOException { - this.phaseStats = in.readMap(StreamInput::readString, PhaseStats::new); + this.phaseStats = in.readMap(PhaseStats::new); this.indicesManaged = in.readVInt(); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecyclePolicy.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecyclePolicy.java index c2d2303a3a4a5..4beebbe971440 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecyclePolicy.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecyclePolicy.java @@ -101,7 +101,7 @@ public LifecyclePolicy(String name, Map phases, @Nullable Map runtimeStateMap) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java index 4185b16eb1444..699d6d3b02397 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java @@ -295,7 +295,7 @@ public DatafeedConfig(StreamInput in) throws IOException { } this.scrollSize = in.readOptionalVInt(); this.chunkingConfig = in.readOptionalWriteable(ChunkingConfig::new); - this.headers = in.readImmutableMap(StreamInput::readString, StreamInput::readString); + this.headers = in.readImmutableMap(StreamInput::readString); delayedDataCheckConfig = in.readOptionalWriteable(DelayedDataCheckConfig::new); maxEmptySearches = in.readOptionalVInt(); indicesOptions = IndicesOptions.readIndicesOptions(in); @@ -808,7 +808,7 @@ public Builder(StreamInput in) throws IOException { } this.scrollSize = in.readOptionalVInt(); this.chunkingConfig = in.readOptionalWriteable(ChunkingConfig::new); - this.headers = in.readImmutableMap(StreamInput::readString, StreamInput::readString); + this.headers = in.readImmutableMap(StreamInput::readString); delayedDataCheckConfig = in.readOptionalWriteable(DelayedDataCheckConfig::new); maxEmptySearches = in.readOptionalVInt(); if (in.readBoolean()) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/DataFrameAnalyticsConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/DataFrameAnalyticsConfig.java index 3095c1470faf1..49759f2ec358e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/DataFrameAnalyticsConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/DataFrameAnalyticsConfig.java @@ -186,7 +186,7 @@ public DataFrameAnalyticsConfig(StreamInput in) throws IOException { this.analysis = in.readNamedWriteable(DataFrameAnalysis.class); this.analyzedFields = in.readOptionalWriteable(FetchSourceContext::readFrom); this.modelMemoryLimit = in.readOptionalWriteable(ByteSizeValue::readFrom); - this.headers = in.readImmutableMap(StreamInput::readString, StreamInput::readString); + this.headers = in.readImmutableMap(StreamInput::readString); this.createTime = in.readOptionalInstant(); this.version = in.readBoolean() ? Version.readVersion(in) : null; this.allowLazyStart = in.readBoolean(); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/TrainedModelConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/TrainedModelConfig.java index 17a59fd1042c8..900a62772c31c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/TrainedModelConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/TrainedModelConfig.java @@ -256,7 +256,7 @@ public TrainedModelConfig(StreamInput in) throws IOException { modelSize = in.readVLong(); estimatedOperations = in.readVLong(); licenseLevel = License.OperationMode.parse(in.readString()); - this.defaultFieldMap = in.readBoolean() ? in.readImmutableMap(StreamInput::readString, StreamInput::readString) : null; + this.defaultFieldMap = in.readBoolean() ? in.readImmutableMap(StreamInput::readString) : null; this.inferenceConfig = in.readOptionalNamedWriteable(InferenceConfig.class); if (in.getTransportVersion().onOrAfter(VERSION_3RD_PARTY_CONFIG_ADDED)) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/FrequencyEncoding.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/FrequencyEncoding.java index 5c059d4ef6a0e..034b6721ec1ec 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/FrequencyEncoding.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/FrequencyEncoding.java @@ -86,7 +86,7 @@ public FrequencyEncoding(String field, String featureName, Map f public FrequencyEncoding(StreamInput in) throws IOException { this.field = in.readString(); this.featureName = in.readString(); - this.frequencyMap = in.readImmutableMap(StreamInput::readString, StreamInput::readDouble); + this.frequencyMap = in.readImmutableMap(StreamInput::readDouble); this.custom = in.readBoolean(); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/OneHotEncoding.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/OneHotEncoding.java index ba2c802c9addb..cd0a91466dced 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/OneHotEncoding.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/OneHotEncoding.java @@ -74,7 +74,7 @@ public OneHotEncoding(String field, Map hotMap, Boolean custom) public OneHotEncoding(StreamInput in) throws IOException { this.field = in.readString(); - this.hotMap = Collections.unmodifiableMap(new TreeMap<>(in.readMap(StreamInput::readString, StreamInput::readString))); + this.hotMap = Collections.unmodifiableMap(new TreeMap<>(in.readMap(StreamInput::readString))); this.custom = in.readBoolean(); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/TargetMeanEncoding.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/TargetMeanEncoding.java index 8ed2560bbdd7b..ac69bec04c619 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/TargetMeanEncoding.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/preprocessing/TargetMeanEncoding.java @@ -90,7 +90,7 @@ public TargetMeanEncoding(String field, String featureName, Map public TargetMeanEncoding(StreamInput in) throws IOException { this.field = in.readString(); this.featureName = in.readString(); - this.meanMap = in.readImmutableMap(StreamInput::readString, StreamInput::readDouble); + this.meanMap = in.readImmutableMap(StreamInput::readDouble); this.defaultValue = in.readDouble(); this.custom = in.readBoolean(); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/RuleScope.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/RuleScope.java index faec24fbf966b..24b4d324cd894 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/RuleScope.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/RuleScope.java @@ -68,7 +68,7 @@ public RuleScope(Map scope) { } public RuleScope(StreamInput in) throws IOException { - scope = in.readMap(StreamInput::readString, FilterRef::new); + scope = in.readMap(FilterRef::new); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/stats/CountAccumulator.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/stats/CountAccumulator.java index 98c07ccdf4d64..60e4f748df217 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/stats/CountAccumulator.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/stats/CountAccumulator.java @@ -37,7 +37,7 @@ private CountAccumulator(Map counts) { } public CountAccumulator(StreamInput in) throws IOException { - this.counts = in.readMap(StreamInput::readString, StreamInput::readLong); + this.counts = in.readMap(StreamInput::readLong); } public void merge(CountAccumulator other) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupCapsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupCapsAction.java index 5bc9e44da3366..86e3720468c79 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupCapsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupCapsAction.java @@ -116,7 +116,7 @@ public Response(Map jobs) { } Response(StreamInput in) throws IOException { - jobs = in.readImmutableMap(StreamInput::readString, RollableIndexCaps::new); + jobs = in.readImmutableMap(RollableIndexCaps::new); } public Map getJobs() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupIndexCapsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupIndexCapsAction.java index 4fd7d244c7d11..cd5be88bf7b7c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupIndexCapsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupIndexCapsAction.java @@ -145,7 +145,7 @@ public Response(Map jobs) { } Response(StreamInput in) throws IOException { - jobs = in.readMap(StreamInput::readString, RollableIndexCaps::new); + jobs = in.readMap(RollableIndexCaps::new); } public Map getJobs() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/RollupJobCaps.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/RollupJobCaps.java index 768613b2e51ec..f11e56edf5449 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/RollupJobCaps.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/RollupJobCaps.java @@ -70,7 +70,7 @@ public RollupJobCaps(StreamInput in) throws IOException { this.jobID = in.readString(); this.rollupIndex = in.readString(); this.indexPattern = in.readString(); - this.fieldCapLookup = in.readMap(StreamInput::readString, RollupFieldCaps::new); + this.fieldCapLookup = in.readMap(RollupFieldCaps::new); } public Map getFieldCaps() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/job/RollupJob.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/job/RollupJob.java index 9566366b74beb..683f39be9cc98 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/job/RollupJob.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/job/RollupJob.java @@ -57,7 +57,7 @@ public RollupJob(RollupJobConfig config, Map headers) { public RollupJob(StreamInput in) throws IOException { this.config = new RollupJobConfig(in); - headers = in.readMap(StreamInput::readString, StreamInput::readString); + headers = in.readMap(StreamInput::readString); } public RollupJobConfig getConfig() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/apikey/BulkUpdateApiKeyResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/apikey/BulkUpdateApiKeyResponse.java index c6b9822b2ae75..c6d2c07f70127 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/apikey/BulkUpdateApiKeyResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/apikey/BulkUpdateApiKeyResponse.java @@ -37,7 +37,7 @@ public BulkUpdateApiKeyResponse(StreamInput in) throws IOException { super(in); this.updated = in.readStringList(); this.noops = in.readStringList(); - this.errorDetails = in.readMap(StreamInput::readString, StreamInput::readException); + this.errorDetails = in.readMap(StreamInput::readException); } public List getUpdated() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/privilege/PutPrivilegesResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/privilege/PutPrivilegesResponse.java index 3bb73a58c0c69..6a5b9646dc0f8 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/privilege/PutPrivilegesResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/privilege/PutPrivilegesResponse.java @@ -27,7 +27,7 @@ public final class PutPrivilegesResponse extends ActionResponse implements ToXCo public PutPrivilegesResponse(StreamInput in) throws IOException { super(in); - this.created = in.readImmutableMap(StreamInput::readString, StreamInput::readStringList); + this.created = in.readImmutableMap(StreamInput::readStringList); } public PutPrivilegesResponse(Map> created) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/profile/GetProfilesResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/profile/GetProfilesResponse.java index 5dce557821110..08239f2a1d4b9 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/profile/GetProfilesResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/profile/GetProfilesResponse.java @@ -32,7 +32,7 @@ public GetProfilesResponse(List profiles, Map errors public GetProfilesResponse(StreamInput in) throws IOException { super(in); this.profiles = in.readImmutableList(Profile::new); - this.errors = in.readMap(StreamInput::readString, StreamInput::readException); + this.errors = in.readMap(StreamInput::readException); } public List getProfiles() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/profile/SuggestProfilesRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/profile/SuggestProfilesRequest.java index 3df1b77eac498..dddcef16a455f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/profile/SuggestProfilesRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/profile/SuggestProfilesRequest.java @@ -140,7 +140,7 @@ public Hint(List uids, Map labelsInput) { public Hint(StreamInput in) throws IOException { this.uids = in.readStringList(); - this.labels = in.readMapOfLists(StreamInput::readString, StreamInput::readString); + this.labels = in.readMapOfLists(StreamInput::readString); } public List getUids() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersResponse.java index 1c3a1fa869063..6095a05cd5336 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersResponse.java @@ -45,7 +45,7 @@ public GetUsersResponse(StreamInput in) throws IOException { } if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_5_0)) { if (in.readBoolean()) { - profileUidLookup = in.readMap(StreamInput::readString, StreamInput::readString); + profileUidLookup = in.readMap(StreamInput::readString); } else { profileUidLookup = null; } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesResponse.java index fc2f5e0579d03..073e639715bce 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesResponse.java @@ -40,9 +40,9 @@ public HasPrivilegesResponse() { public HasPrivilegesResponse(StreamInput in) throws IOException { super(in); completeMatch = in.readBoolean(); - cluster = in.readMap(StreamInput::readString, StreamInput::readBoolean); + cluster = in.readMap(StreamInput::readBoolean); index = readResourcePrivileges(in); - application = in.readMap(StreamInput::readString, HasPrivilegesResponse::readResourcePrivileges); + application = in.readMap(HasPrivilegesResponse::readResourcePrivileges); username = in.readString(); } @@ -119,7 +119,7 @@ private static Set readResourcePrivileges(StreamInput in) th final Set set = new TreeSet<>(Comparator.comparing(o -> o.getResource())); for (int i = 0; i < count; i++) { final String index = in.readString(); - final Map privileges = in.readMap(StreamInput::readString, StreamInput::readBoolean); + final Map privileges = in.readMap(StreamInput::readBoolean); set.add(ResourcePrivileges.builder(index).addPrivileges(privileges).build()); } return set; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/ProfileHasPrivilegesResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/ProfileHasPrivilegesResponse.java index 0f2380f1c0fb2..c3e20d4d6e4e9 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/ProfileHasPrivilegesResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/ProfileHasPrivilegesResponse.java @@ -27,7 +27,7 @@ public class ProfileHasPrivilegesResponse extends ActionResponse implements ToXC public ProfileHasPrivilegesResponse(StreamInput in) throws IOException { super(in); this.hasPrivilegeUids = in.readSet(StreamInput::readString); - this.errors = in.readMap(StreamInput::readString, StreamInput::readException); + this.errors = in.readMap(StreamInput::readException); } public ProfileHasPrivilegesResponse(Set hasPrivilegeUids, Map errors) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/slm/SnapshotLifecycleMetadata.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/slm/SnapshotLifecycleMetadata.java index 49f9b73bff055..5f1483e4c6004 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/slm/SnapshotLifecycleMetadata.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/slm/SnapshotLifecycleMetadata.java @@ -93,7 +93,7 @@ public SnapshotLifecycleMetadata( } public SnapshotLifecycleMetadata(StreamInput in) throws IOException { - this.snapshotConfigurations = in.readMap(StreamInput::readString, SnapshotLifecyclePolicyMetadata::new); + this.snapshotConfigurations = in.readMap(SnapshotLifecyclePolicyMetadata::new); this.operationMode = in.readEnum(OperationMode.class); this.slmStats = new SnapshotLifecycleStats(in); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/slm/SnapshotLifecycleStats.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/slm/SnapshotLifecycleStats.java index c7fc42b18dbeb..10ab898b34f71 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/slm/SnapshotLifecycleStats.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/slm/SnapshotLifecycleStats.java @@ -98,7 +98,7 @@ public SnapshotLifecycleStats( } public SnapshotLifecycleStats(StreamInput in) throws IOException { - this.policyStats = new ConcurrentHashMap<>(in.readMap(StreamInput::readString, SnapshotPolicyStats::new)); + this.policyStats = new ConcurrentHashMap<>(in.readMap(SnapshotPolicyStats::new)); this.retentionRunCount.inc(in.readVLong()); this.retentionFailedCount.inc(in.readVLong()); this.retentionTimedOut.inc(in.readVLong()); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/textstructure/structurefinder/TextStructure.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/textstructure/structurefinder/TextStructure.java index 4835bc717fc58..1a5e23b0ca18c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/textstructure/structurefinder/TextStructure.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/textstructure/structurefinder/TextStructure.java @@ -237,7 +237,7 @@ public TextStructure(StreamInput in) throws IOException { needClientTimezone = in.readBoolean(); mappings = Collections.unmodifiableSortedMap(new TreeMap<>(in.readMap())); ingestPipeline = in.readBoolean() ? Collections.unmodifiableMap(in.readMap()) : null; - fieldStats = Collections.unmodifiableSortedMap(new TreeMap<>(in.readMap(StreamInput::readString, FieldStats::new))); + fieldStats = Collections.unmodifiableSortedMap(new TreeMap<>(in.readMap(FieldStats::new))); explanation = in.readImmutableList(StreamInput::readString); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformFeatureSetUsage.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformFeatureSetUsage.java index 0941c4667bb7f..5d58284daa2b6 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformFeatureSetUsage.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformFeatureSetUsage.java @@ -31,8 +31,8 @@ public class TransformFeatureSetUsage extends Usage { public TransformFeatureSetUsage(StreamInput in) throws IOException { super(in); - this.transformCountByState = in.readMap(StreamInput::readString, StreamInput::readLong); - this.transformCountByFeature = in.readMap(StreamInput::readString, StreamInput::readLong); + this.transformCountByState = in.readMap(StreamInput::readLong); + this.transformCountByFeature = in.readMap(StreamInput::readLong); this.accumulatedStats = new TransformIndexerStats(in); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/ValidateTransformAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/ValidateTransformAction.java index 48b18606d024b..3b5163dbf4c2d 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/ValidateTransformAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/ValidateTransformAction.java @@ -105,7 +105,7 @@ public Response(Map destIndexMappings) { } public Response(StreamInput in) throws IOException { - this.destIndexMappings = in.readMap(StreamInput::readString, StreamInput::readString); + this.destIndexMappings = in.readMap(StreamInput::readString); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/NodeAttributes.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/NodeAttributes.java index 1192260f78013..3cf91be019b60 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/NodeAttributes.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/NodeAttributes.java @@ -83,7 +83,7 @@ public NodeAttributes(StreamInput in) throws IOException { this.name = in.readString(); this.ephemeralId = in.readString(); this.transportAddress = in.readString(); - this.attributes = in.readImmutableMap(StreamInput::readString, StreamInput::readString); + this.attributes = in.readImmutableMap(StreamInput::readString); } /** diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java index b82569e4f911d..853313ea60cec 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java @@ -247,7 +247,7 @@ public TransformConfig(final StreamInput in) throws IOException { source = new SourceConfig(in); dest = new DestConfig(in); frequency = in.readOptionalTimeValue(); - setHeaders(in.readMap(StreamInput::readString, StreamInput::readString)); + setHeaders(in.readMap(StreamInput::readString)); pivotConfig = in.readOptionalWriteable(PivotConfig::new); latestConfig = in.readOptionalWriteable(LatestConfig::new); description = in.readOptionalString(); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java index 25e25dfe80e0f..6ac924fe87e8c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java @@ -114,7 +114,7 @@ public TransformConfigUpdate(final StreamInput in) throws IOException { description = in.readOptionalString(); syncConfig = in.readOptionalNamedWriteable(SyncConfig.class); if (in.readBoolean()) { - setHeaders(in.readMap(StreamInput::readString, StreamInput::readString)); + setHeaders(in.readMap(StreamInput::readString)); } settings = in.readOptionalWriteable(SettingsConfig::new); metadata = in.readMap(); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/watch/WatchStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/watch/WatchStatus.java index a59c463e48fe9..719c97e249113 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/watch/WatchStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/watch/WatchStatus.java @@ -72,7 +72,7 @@ public WatchStatus(StreamInput in) throws IOException { executionState = ExecutionState.resolve(in.readString()); } if (in.readBoolean()) { - headers = in.readMap(StreamInput::readString, StreamInput::readString); + headers = in.readMap(StreamInput::readString); } else { headers = Collections.emptyMap(); } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationInfoAction.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationInfoAction.java index 931e039ca968a..1a6f11fa32514 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationInfoAction.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationInfoAction.java @@ -153,13 +153,13 @@ public Response(StreamInput in) throws IOException { super(in); clusterSettingsIssues = in.readList(DeprecationIssue::new); nodeSettingsIssues = in.readList(DeprecationIssue::new); - indexSettingsIssues = in.readMapOfLists(StreamInput::readString, DeprecationIssue::new); + indexSettingsIssues = in.readMapOfLists(DeprecationIssue::new); if (in.getTransportVersion().before(TransportVersion.V_7_11_0)) { List mlIssues = in.readList(DeprecationIssue::new); pluginSettingsIssues = new HashMap<>(); pluginSettingsIssues.put("ml_settings", mlIssues); } else { - pluginSettingsIssues = in.readMapOfLists(StreamInput::readString, DeprecationIssue::new); + pluginSettingsIssues = in.readMapOfLists(DeprecationIssue::new); } } diff --git a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/analytics/action/PostAnalyticsEventAction.java b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/analytics/action/PostAnalyticsEventAction.java index 27a31dd19004b..12dc9e52daf53 100644 --- a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/analytics/action/PostAnalyticsEventAction.java +++ b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/analytics/action/PostAnalyticsEventAction.java @@ -90,7 +90,7 @@ public Request(StreamInput in) throws IOException { this.eventTime = in.readLong(); this.xContentType = in.readEnum(XContentType.class); this.payload = in.readBytesReference(); - this.headers = in.readMap(StreamInput::readString, StreamInput::readStringList); + this.headers = in.readMap(StreamInput::readStringList); this.clientAddress = in.readOptionalString(); } diff --git a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/action/EqlSearchResponse.java b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/action/EqlSearchResponse.java index 63062b5f48511..308363200c866 100644 --- a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/action/EqlSearchResponse.java +++ b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/action/EqlSearchResponse.java @@ -257,7 +257,7 @@ public Event(StreamInput in) throws IOException { id = in.readString(); source = in.readBytesReference(); if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_13_0) && in.readBoolean()) { - fetchFields = in.readMap(StreamInput::readString, DocumentField::new); + fetchFields = in.readMap(DocumentField::new); } else { fetchFields = null; } diff --git a/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/action/GetPipelineResponse.java b/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/action/GetPipelineResponse.java index e10b9183520bc..f28edd25bf483 100644 --- a/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/action/GetPipelineResponse.java +++ b/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/action/GetPipelineResponse.java @@ -29,7 +29,7 @@ public GetPipelineResponse(Map pipelines) { public GetPipelineResponse(StreamInput in) throws IOException { super(in); - this.pipelines = in.readMap(StreamInput::readString, StreamInput::readBytesReference); + this.pipelines = in.readMap(StreamInput::readBytesReference); } public Map pipelines() { diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/FrequentItemSetCollector.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/FrequentItemSetCollector.java index 0b04240e89706..397ddae669aa3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/FrequentItemSetCollector.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/FrequentItemSetCollector.java @@ -59,7 +59,7 @@ public FrequentItemSet(Map> fields, long docCount, double s } public FrequentItemSet(StreamInput in) throws IOException { - this.fields = in.readMapOfLists(StreamInput::readString, StreamInput::readGenericValue); + this.fields = in.readMapOfLists(StreamInput::readGenericValue); this.docCount = in.readVLong(); this.support = in.readDouble(); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/inference/InferencePipelineAggregationBuilder.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/inference/InferencePipelineAggregationBuilder.java index ccff6ae21e0b3..e416f981dda64 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/inference/InferencePipelineAggregationBuilder.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/inference/InferencePipelineAggregationBuilder.java @@ -166,7 +166,7 @@ public InferencePipelineAggregationBuilder( ) throws IOException { super(in, NAME); modelId = in.readString(); - bucketPathMap = in.readMap(StreamInput::readString, StreamInput::readString); + bucketPathMap = in.readMap(StreamInput::readString); inferenceConfig = in.readOptionalNamedWriteable(InferenceConfigUpdate.class); this.modelLoadingService = modelLoadingService; this.model = null; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/kstest/InternalKSTestAggregation.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/kstest/InternalKSTestAggregation.java index 632919bc7ff30..b67acc4c1eba4 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/kstest/InternalKSTestAggregation.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/kstest/InternalKSTestAggregation.java @@ -30,7 +30,7 @@ public InternalKSTestAggregation(String name, Map metadata, Map< public InternalKSTestAggregation(StreamInput in) throws IOException { super(in); - this.modeValues = in.readMap(StreamInput::readString, StreamInput::readDouble); + this.modeValues = in.readMap(StreamInput::readDouble); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/ModelAliasMetadata.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/ModelAliasMetadata.java index 755121af95ea6..9e4018cb2747a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/ModelAliasMetadata.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/ModelAliasMetadata.java @@ -83,7 +83,7 @@ public ModelAliasMetadata(Map modelAliases) { } public ModelAliasMetadata(StreamInput in) throws IOException { - this.modelAliases = in.readImmutableMap(StreamInput::readString, ModelAliasEntry::new); + this.modelAliases = in.readImmutableMap(ModelAliasEntry::new); } public Map modelAliases() { diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/mr/InternalItemSetMapReduceAggregationTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/mr/InternalItemSetMapReduceAggregationTests.java index 837b6b4a06c60..ddf2071ec3511 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/mr/InternalItemSetMapReduceAggregationTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/aggs/frequentitemsets/mr/InternalItemSetMapReduceAggregationTests.java @@ -72,7 +72,7 @@ static class WordCounts implements ToXContent, Writeable, Closeable { } WordCounts(StreamInput in) throws IOException { - this.frequencies = in.readMap(StreamInput::readString, StreamInput::readLong); + this.frequencies = in.readMap(StreamInput::readLong); } @Override diff --git a/x-pack/plugin/profiler/src/main/java/org/elasticsearch/xpack/profiler/GetProfilingResponse.java b/x-pack/plugin/profiler/src/main/java/org/elasticsearch/xpack/profiler/GetProfilingResponse.java index cc2f34a18adf4..1962b31af2cf6 100644 --- a/x-pack/plugin/profiler/src/main/java/org/elasticsearch/xpack/profiler/GetProfilingResponse.java +++ b/x-pack/plugin/profiler/src/main/java/org/elasticsearch/xpack/profiler/GetProfilingResponse.java @@ -37,7 +37,6 @@ public class GetProfilingResponse extends ActionResponse implements ChunkedToXCo public GetProfilingResponse(StreamInput in) throws IOException { this.stackTraces = in.readBoolean() ? in.readMap( - StreamInput::readString, i -> new StackTrace( i.readList(StreamInput::readInt), i.readList(StreamInput::readString), @@ -48,7 +47,6 @@ public GetProfilingResponse(StreamInput in) throws IOException { : null; this.stackFrames = in.readBoolean() ? in.readMap( - StreamInput::readString, i -> new StackFrame( i.readList(StreamInput::readString), i.readList(StreamInput::readString), @@ -57,8 +55,8 @@ public GetProfilingResponse(StreamInput in) throws IOException { ) ) : null; - this.executables = in.readBoolean() ? in.readMap(StreamInput::readString, StreamInput::readString) : null; - this.stackTraceEvents = in.readBoolean() ? in.readMap(StreamInput::readString, StreamInput::readInt) : null; + this.executables = in.readBoolean() ? in.readMap(StreamInput::readString) : null; + this.stackTraceEvents = in.readBoolean() ? in.readMap(StreamInput::readInt) : null; this.totalFrames = in.readInt(); this.samplingRate = in.readDouble(); }