ElasticContainer: Bump V7_0 test server to 7.0.0-beta1

As listed in the "Breaking changes" section of the release notes [1],
index creation requests are rejected when the include_type_name
parameter is not set to "true". This is a new parameter introduced
in 7.0.0, so we set it conditionally only for that version.

[1] https://www.elastic.co/guide/en/elasticsearch/reference/7.0/release-notes-7.0.0-beta1.html

Change-Id: I71ac74567eba11cf4150619a2cb95dce4386ac0f
This commit is contained in:
David Pursehouse
2019-02-18 13:52:19 +09:00
parent 12c859f61f
commit 793eb81ec5
3 changed files with 10 additions and 2 deletions

View File

@@ -163,7 +163,9 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
// Recreate the index.
String indexCreationFields = concatJsonString(getSettings(), getMappings());
response = performRequest("PUT", indexName, indexCreationFields);
response =
performRequest(
"PUT", indexName + client.adapter().includeTypeNameParam(), indexCreationFields);
statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
String error = String.format("Failed to create index %s: %s", indexName, statusCode);

View File

@@ -29,6 +29,7 @@ public class ElasticQueryAdapter {
private final String stringFieldType;
private final String indexProperty;
private final String versionDiscoveryUrl;
private final String includeTypeNameParam;
ElasticQueryAdapter(ElasticVersion version) {
this.ignoreUnmapped = false;
@@ -40,6 +41,7 @@ public class ElasticQueryAdapter {
this.exactFieldType = "keyword";
this.stringFieldType = "text";
this.indexProperty = "true";
this.includeTypeNameParam = version.isV7OrLater() ? "?include_type_name=true" : "";
}
void setIgnoreUnmapped(JsonObject properties) {
@@ -89,4 +91,8 @@ public class ElasticQueryAdapter {
String getVersionDiscoveryUrl(String name) {
return String.format(versionDiscoveryUrl, name);
}
String includeTypeNameParam() {
return includeTypeNameParam;
}
}

View File

@@ -49,7 +49,7 @@ public class ElasticContainer extends ElasticsearchContainer {
case V6_6:
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.6.0";
case V7_0:
return "docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.0-alpha2";
return "docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.0-beta1";
}
throw new IllegalStateException("No tests for version: " + version.name());
}