Skip to content

Commit 5c6e758

Browse files
authored
GeoBoundingBoxQueryGeoShapeIT should take into account the index version (elastic#72605)
GeoShape legacy parameters should only be used when version is lower than 8.0.
1 parent 3f6ad3e commit 5c6e758

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

server/src/internalClusterTest/java/org/elasticsearch/search/geo/AbstractGeoBoundingBoxQueryIT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ protected boolean forbidPrivateIndexSettings() {
3838
return false;
3939
}
4040

41-
public abstract XContentBuilder getMapping() throws IOException;
41+
public abstract XContentBuilder getMapping(Version version) throws IOException;
4242

4343
public void testSimpleBoundingBoxTest() throws Exception {
4444
Version version = VersionUtils.randomIndexCompatibleVersion(random());
4545
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
46-
XContentBuilder xContentBuilder = getMapping();
46+
XContentBuilder xContentBuilder = getMapping(version);
4747
assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder));
4848
ensureGreen();
4949

@@ -121,7 +121,7 @@ public void testSimpleBoundingBoxTest() throws Exception {
121121
public void testLimit2BoundingBox() throws Exception {
122122
Version version = VersionUtils.randomIndexCompatibleVersion(random());
123123
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
124-
XContentBuilder xContentBuilder = getMapping();
124+
XContentBuilder xContentBuilder = getMapping(version);
125125
assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder));
126126
ensureGreen();
127127

@@ -188,7 +188,7 @@ public void testLimit2BoundingBox() throws Exception {
188188
public void testCompleteLonRange() throws Exception {
189189
Version version = VersionUtils.randomIndexCompatibleVersion(random());
190190
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
191-
XContentBuilder xContentBuilder = getMapping();
191+
XContentBuilder xContentBuilder = getMapping(version);
192192
assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder));
193193
ensureGreen();
194194

server/src/internalClusterTest/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryGeoPointIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
package org.elasticsearch.search.geo;
1010

11+
import org.elasticsearch.Version;
1112
import org.elasticsearch.common.xcontent.XContentBuilder;
1213
import org.elasticsearch.common.xcontent.XContentFactory;
1314

@@ -16,7 +17,7 @@
1617
public class GeoBoundingBoxQueryGeoPointIT extends AbstractGeoBoundingBoxQueryIT {
1718

1819
@Override
19-
public XContentBuilder getMapping() throws IOException {
20+
public XContentBuilder getMapping(Version version) throws IOException {
2021
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("_doc")
2122
.startObject("properties").startObject("location").field("type", "geo_point");
2223
xContentBuilder.endObject().endObject().endObject().endObject();

server/src/internalClusterTest/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryGeoShapeIT.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@
88

99
package org.elasticsearch.search.geo;
1010

11-
import org.apache.lucene.util.LuceneTestCase;
11+
import org.elasticsearch.Version;
1212
import org.elasticsearch.common.xcontent.XContentBuilder;
1313
import org.elasticsearch.common.xcontent.XContentFactory;
1414

1515
import java.io.IOException;
1616

17-
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/72602")
1817
public class GeoBoundingBoxQueryGeoShapeIT extends AbstractGeoBoundingBoxQueryIT {
1918

2019
@Override
21-
public XContentBuilder getMapping() throws IOException {
20+
public XContentBuilder getMapping(Version version) throws IOException {
2221
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("_doc")
2322
.startObject("properties").startObject("location").field("type", "geo_shape");
24-
if (randomBoolean()) {
23+
if (version.before(Version.V_8_0_0) && randomBoolean()) {
2524
xContentBuilder.field("strategy", "recursive");
2625
}
2726
xContentBuilder.endObject().endObject().endObject().endObject();

0 commit comments

Comments
 (0)