From b6e20d9fcdafbc1337d12241636ab61449329890 Mon Sep 17 00:00:00 2001 From: iverase Date: Mon, 3 May 2021 08:37:39 +0200 Subject: [PATCH] make sure we don;t use legacy parameters for version 8.0 --- .../search/geo/AbstractGeoBoundingBoxQueryIT.java | 8 ++++---- .../search/geo/GeoBoundingBoxQueryGeoPointIT.java | 3 ++- .../search/geo/GeoBoundingBoxQueryGeoShapeIT.java | 7 +++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/src/internalClusterTest/java/org/elasticsearch/search/geo/AbstractGeoBoundingBoxQueryIT.java b/server/src/internalClusterTest/java/org/elasticsearch/search/geo/AbstractGeoBoundingBoxQueryIT.java index c5a669b7bb57c..0336b1bd8cd08 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/search/geo/AbstractGeoBoundingBoxQueryIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/search/geo/AbstractGeoBoundingBoxQueryIT.java @@ -38,12 +38,12 @@ protected boolean forbidPrivateIndexSettings() { return false; } - public abstract XContentBuilder getMapping() throws IOException; + public abstract XContentBuilder getMapping(Version version) throws IOException; public void testSimpleBoundingBoxTest() throws Exception { Version version = VersionUtils.randomIndexCompatibleVersion(random()); Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build(); - XContentBuilder xContentBuilder = getMapping(); + XContentBuilder xContentBuilder = getMapping(version); assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder)); ensureGreen(); @@ -121,7 +121,7 @@ public void testSimpleBoundingBoxTest() throws Exception { public void testLimit2BoundingBox() throws Exception { Version version = VersionUtils.randomIndexCompatibleVersion(random()); Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build(); - XContentBuilder xContentBuilder = getMapping(); + XContentBuilder xContentBuilder = getMapping(version); assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder)); ensureGreen(); @@ -188,7 +188,7 @@ public void testLimit2BoundingBox() throws Exception { public void testCompleteLonRange() throws Exception { Version version = VersionUtils.randomIndexCompatibleVersion(random()); Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build(); - XContentBuilder xContentBuilder = getMapping(); + XContentBuilder xContentBuilder = getMapping(version); assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder)); ensureGreen(); diff --git a/server/src/internalClusterTest/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryGeoPointIT.java b/server/src/internalClusterTest/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryGeoPointIT.java index db1ca972c6464..6dbb41810f352 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryGeoPointIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryGeoPointIT.java @@ -8,6 +8,7 @@ package org.elasticsearch.search.geo; +import org.elasticsearch.Version; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -16,7 +17,7 @@ public class GeoBoundingBoxQueryGeoPointIT extends AbstractGeoBoundingBoxQueryIT { @Override - public XContentBuilder getMapping() throws IOException { + public XContentBuilder getMapping(Version version) throws IOException { XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("_doc") .startObject("properties").startObject("location").field("type", "geo_point"); xContentBuilder.endObject().endObject().endObject().endObject(); diff --git a/server/src/internalClusterTest/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryGeoShapeIT.java b/server/src/internalClusterTest/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryGeoShapeIT.java index 08432aec45579..22abcc9014d20 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryGeoShapeIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryGeoShapeIT.java @@ -8,20 +8,19 @@ package org.elasticsearch.search.geo; -import org.apache.lucene.util.LuceneTestCase; +import org.elasticsearch.Version; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import java.io.IOException; -@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/72602") public class GeoBoundingBoxQueryGeoShapeIT extends AbstractGeoBoundingBoxQueryIT { @Override - public XContentBuilder getMapping() throws IOException { + public XContentBuilder getMapping(Version version) throws IOException { XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("_doc") .startObject("properties").startObject("location").field("type", "geo_shape"); - if (randomBoolean()) { + if (version.before(Version.V_8_0_0) && randomBoolean()) { xContentBuilder.field("strategy", "recursive"); } xContentBuilder.endObject().endObject().endObject().endObject();