Elasticsearch: Add support for version 6.3.0
6.3.0 is now the latest version on the 6.x series. Update the version detection to support this version, and add support for it in the query adapter. There don't seem to be any breaking changes since 6.2.x, so it's not necessary to add any specific handling other than modifying some conditions to check for 6.3 in addition to 6.2. Update the test container to support 6.3, using the -oss version of 6.3.0 from the elastic.co docker registry. Update the V6 query tests to use 6.3 instead of 6.2. To test against both 6.2 and 6.3 we would need to duplicate the account, group and query test classes again resulting in 4 copies (V2, V5, V6.2, V6.3) of each. If we need to explicitly test against 6.2 at any point in the future we can manually change them back to use the 6.2 container. Update the index and reindex tests to explicitly test 6.3 in addition to 6.2, since those tests can be extended simply by adding another @ConfigSuite.Config annotation. Change-Id: I02afbac3e04958a13a6baae74e9d0de9cd3b644b
This commit is contained in:
@@ -48,10 +48,15 @@ public class ElasticReindexIT extends AbstractReindexTests {
|
||||
}
|
||||
|
||||
@ConfigSuite.Config
|
||||
public static Config elasticsearchV6() {
|
||||
public static Config elasticsearchV6_2() {
|
||||
return getConfig(ElasticVersion.V6_2);
|
||||
}
|
||||
|
||||
@ConfigSuite.Config
|
||||
public static Config elasticsearchV6_3() {
|
||||
return getConfig(ElasticVersion.V6_3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureIndex(Injector injector) throws Exception {
|
||||
ElasticTestUtils.createAllIndexes(injector);
|
||||
|
@@ -47,10 +47,15 @@ public class ElasticIndexIT extends AbstractIndexTests {
|
||||
}
|
||||
|
||||
@ConfigSuite.Config
|
||||
public static Config elasticsearchV6() {
|
||||
public static Config elasticsearchV6_2() {
|
||||
return getConfig(ElasticVersion.V6_2);
|
||||
}
|
||||
|
||||
@ConfigSuite.Config
|
||||
public static Config elasticsearchV6_3() {
|
||||
return getConfig(ElasticVersion.V6_3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureIndex(Injector injector) throws Exception {
|
||||
ElasticTestUtils.createAllIndexes(injector);
|
||||
|
@@ -31,13 +31,13 @@ public class ElasticQueryAdapter {
|
||||
|
||||
ElasticQueryAdapter(ElasticVersion version) {
|
||||
this.ignoreUnmapped = version == ElasticVersion.V2_4;
|
||||
this.usePostV5Type = version == ElasticVersion.V6_2;
|
||||
|
||||
this.versionDiscoveryUrl = version == ElasticVersion.V6_2 ? "%s*" : "%s*/_aliases";
|
||||
this.usePostV5Type = isV6(version);
|
||||
this.versionDiscoveryUrl = isV6(version) ? "%s*" : "%s*/_aliases";
|
||||
|
||||
switch (version) {
|
||||
case V5_6:
|
||||
case V6_2:
|
||||
case V6_3:
|
||||
this.searchFilteringName = "_source";
|
||||
this.indicesExistParam = "?allow_no_indices=false";
|
||||
this.exactFieldType = "keyword";
|
||||
@@ -55,6 +55,10 @@ public class ElasticQueryAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isV6(ElasticVersion version) {
|
||||
return version == ElasticVersion.V6_2 || version == ElasticVersion.V6_3;
|
||||
}
|
||||
|
||||
void setIgnoreUnmapped(JsonObject properties) {
|
||||
if (ignoreUnmapped) {
|
||||
properties.addProperty("ignore_unmapped", true);
|
||||
|
@@ -20,7 +20,8 @@ import java.util.regex.Pattern;
|
||||
public enum ElasticVersion {
|
||||
V2_4("2.4.*"),
|
||||
V5_6("5.6.*"),
|
||||
V6_2("6.2.*");
|
||||
V6_2("6.2.*"),
|
||||
V6_3("6.3.*");
|
||||
|
||||
private final String version;
|
||||
private final Pattern pattern;
|
||||
|
@@ -49,6 +49,8 @@ public class ElasticContainer<SELF extends ElasticContainer<SELF>> extends Gener
|
||||
return "elasticsearch:5.6.10-alpine";
|
||||
case V6_2:
|
||||
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.4";
|
||||
case V6_3:
|
||||
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.0";
|
||||
}
|
||||
throw new IllegalStateException("No tests for version: " + version.name());
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ public class ElasticV6QueryAccountsTest extends AbstractQueryAccountsTest {
|
||||
return;
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_2);
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_3);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
|
@@ -37,7 +37,7 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
|
||||
return;
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_2);
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_3);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,7 @@ public class ElasticV6QueryGroupsTest extends AbstractQueryGroupsTest {
|
||||
return;
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_2);
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_3);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,9 @@ public class ElasticVersionTest {
|
||||
|
||||
assertThat(ElasticVersion.forVersion("6.2.0")).isEqualTo(ElasticVersion.V6_2);
|
||||
assertThat(ElasticVersion.forVersion("6.2.4")).isEqualTo(ElasticVersion.V6_2);
|
||||
|
||||
assertThat(ElasticVersion.forVersion("6.3.0")).isEqualTo(ElasticVersion.V6_3);
|
||||
assertThat(ElasticVersion.forVersion("6.3.1")).isEqualTo(ElasticVersion.V6_3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user