From f55b09bae4d6860af425d1dd2cb12e8753b7ea6c Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Thu, 24 May 2018 08:55:14 -0700 Subject: [PATCH] Update the version checks around ip_range bucket keys, now that the change was backported. --- .../rest-api-spec/test/search.aggregation/40_range.yml | 4 ++-- .../search/aggregations/bucket/range/InternalBinaryRange.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/40_range.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/40_range.yml index bc845928a04..c75f4175e6b 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/40_range.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/40_range.yml @@ -213,8 +213,8 @@ setup: --- "IP Range Key Generation": - skip: - version: " - 6.99.99" - reason: "Before 7.0.0, ip_range did not always generate bucket keys (see #21045)." + version: " - 6.3.99" + reason: "Before 6.4.0, ip_range did not always generate bucket keys (see #21045)." - do: search: diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRange.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRange.java index c647a38f7e0..60431e2f829 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRange.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRange.java @@ -74,7 +74,7 @@ public final class InternalBinaryRange } private static Bucket createFromStream(StreamInput in, DocValueFormat format, boolean keyed) throws IOException { - String key = in.getVersion().onOrAfter(Version.V_7_0_0_alpha1) + String key = in.getVersion().onOrAfter(Version.V_6_4_0) ? in.readString() : in.readOptionalString(); @@ -88,7 +88,7 @@ public final class InternalBinaryRange @Override public void writeTo(StreamOutput out) throws IOException { - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_6_4_0)) { out.writeString(key); } else { out.writeOptionalString(key);