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:
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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());
|
||||
}
|
||||
|
Reference in New Issue
Block a user