Skip to content

Commit

Permalink
add transport version
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrik-es committed Jan 12, 2024
1 parent 4768748 commit f4c5182
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ static TransportVersion def(int id) {
public static final TransportVersion HOT_THREADS_AS_BYTES = def(8_571_00_0);
public static final TransportVersion ML_INFERENCE_REQUEST_INPUT_TYPE_ADDED = def(8_572_00_0);
public static final TransportVersion ESQL_ENRICH_POLICY_CCQ_MODE = def(8_573_00_0);
public static final TransportVersion DATE_HISTOGRAM_SUPPORT_DOWNSAMPLED_TZ = def(8_573_00_0);

/*
* STOP! READ THIS FIRST! No, really,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import org.apache.lucene.util.CollectionUtil;
import org.apache.lucene.util.PriorityQueue;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.Rounding;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -246,7 +247,11 @@ public InternalDateHistogram(StreamInput in) throws IOException {
offset = in.readLong();
format = in.readNamedWriteable(DocValueFormat.class);
keyed = in.readBoolean();
downsampledResultsOffset = in.readBoolean(); // FIXME - add transport version
if (in.getTransportVersion().onOrAfter(TransportVersions.DATE_HISTOGRAM_SUPPORT_DOWNSAMPLED_TZ)) {
downsampledResultsOffset = in.readBoolean();
} else {
downsampledResultsOffset = false;
}
buckets = in.readCollectionAsList(stream -> new Bucket(stream, keyed, format));
}

Expand All @@ -260,7 +265,9 @@ protected void doWriteTo(StreamOutput out) throws IOException {
out.writeLong(offset);
out.writeNamedWriteable(format);
out.writeBoolean(keyed);
out.writeBoolean(downsampledResultsOffset);
if (out.getTransportVersion().onOrAfter(TransportVersions.DATE_HISTOGRAM_SUPPORT_DOWNSAMPLED_TZ)) {
out.writeBoolean(downsampledResultsOffset);
}
out.writeCollection(buckets);
}

Expand Down

0 comments on commit f4c5182

Please sign in to comment.