Skip to content

Commit

Permalink
Deduplicate the name of the aggregation when deserializing InternalAg…
Browse files Browse the repository at this point in the history
…gregation (elastic#116307)
  • Loading branch information
iverase committed Nov 8, 2024
1 parent 69b89ae commit d07ba89
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.elasticsearch.search.aggregations;

import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.DelayableWriteable;
import org.elasticsearch.common.io.stream.NamedWriteable;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -51,7 +52,12 @@ protected InternalAggregation(String name, Map<String, Object> metadata) {
* Read from a stream.
*/
protected InternalAggregation(StreamInput in) throws IOException {
name = in.readString();
final String name = in.readString();
if (in instanceof DelayableWriteable.Deduplicator d) {
this.name = d.deduplicate(name);
} else {
this.name = name;
}
metadata = in.readGenericMap();
}

Expand Down

0 comments on commit d07ba89

Please sign in to comment.