diff --git a/qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/NetNewSystemIndicesIT.java b/qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/NetNewSystemIndicesIT.java index f345b79a377e7..efa815756b582 100644 --- a/qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/NetNewSystemIndicesIT.java +++ b/qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/NetNewSystemIndicesIT.java @@ -10,7 +10,6 @@ package org.elasticsearch.system.indices; import org.apache.http.util.EntityUtils; -import org.elasticsearch.Version; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; @@ -36,7 +35,7 @@ protected Settings restClientSettings() { public void testCreatingSystemIndex() throws Exception { ResponseException e = expectThrows( ResponseException.class, - () -> client().performRequest(new Request("PUT", "/.net-new-system-index-" + Version.CURRENT.major)) + () -> client().performRequest(new Request("PUT", "/.net-new-system-index-primary")) ); assertThat(EntityUtils.toString(e.getResponse().getEntity()), containsString("system")); @@ -48,7 +47,7 @@ public void testIndexDoc() throws Exception { String id = randomAlphaOfLength(4); ResponseException e = expectThrows(ResponseException.class, () -> { - Request request = new Request("PUT", "/.net-new-system-index-" + Version.CURRENT.major + "/_doc" + id); + Request request = new Request("PUT", "/.net-new-system-index-primary/_doc" + id); request.setJsonEntity("{}"); client().performRequest(request); }); @@ -91,7 +90,7 @@ public void testSearch() throws Exception { assertThat(EntityUtils.toString(searchResponse.getEntity()), not(containsString(".net-new"))); // direct index search - Request directRequest = new Request("GET", "/.net-new-system-index-" + Version.CURRENT.major + "/_search"); + Request directRequest = new Request("GET", "/.net-new-system-index-primary/_search"); directRequest.setJsonEntity("{ \"query\": { \"match_all\": {} } }"); directRequest.addParameter("size", "10000"); ResponseException e = expectThrows(ResponseException.class, () -> client().performRequest(directRequest)); diff --git a/qa/system-indices/src/main/java/org/elasticsearch/system/indices/SystemIndicesQA.java b/qa/system-indices/src/main/java/org/elasticsearch/system/indices/SystemIndicesQA.java index d4b242e613c95..e6325d8bad6f6 100644 --- a/qa/system-indices/src/main/java/org/elasticsearch/system/indices/SystemIndicesQA.java +++ b/qa/system-indices/src/main/java/org/elasticsearch/system/indices/SystemIndicesQA.java @@ -9,7 +9,6 @@ package org.elasticsearch.system.indices; -import org.elasticsearch.Version; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.client.internal.node.NodeClient; @@ -76,7 +75,7 @@ public Collection getSystemIndexDescriptors(Settings sett ) .setOrigin(TASKS_ORIGIN) .setVersionMetaKey("version") - .setPrimaryIndex(".net-new-system-index-" + Version.CURRENT.major) + .setPrimaryIndex(".net-new-system-index-primary") .build(), SystemIndexDescriptor.builder() .setIndexPattern(INTERNAL_UNMANAGED_INDEX_NAME) @@ -99,7 +98,7 @@ public Collection getSystemIndexDescriptors(Settings sett ) .setOrigin(TASKS_ORIGIN) .setVersionMetaKey("version") - .setPrimaryIndex(".internal-managed-index-" + Version.CURRENT.major) + .setPrimaryIndex(".internal-managed-index-primary") .setAliasName(".internal-managed-alias") .build() ); @@ -110,7 +109,6 @@ private static XContentBuilder mappings() { return jsonBuilder().startObject() .startObject(SINGLE_MAPPING_NAME) .startObject("_meta") - .field("version", Version.CURRENT) .field(SystemIndexDescriptor.VERSION_META_KEY, 1) .endObject() .field("dynamic", "strict") @@ -155,7 +153,7 @@ public List routes() { protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException { return channel -> client.admin() .indices() - .create(new CreateIndexRequest(".net-new-system-index-" + Version.CURRENT.major), new RestToXContentListener<>(channel)); + .create(new CreateIndexRequest(".net-new-system-index-primary"), new RestToXContentListener<>(channel)); } @Override @@ -177,7 +175,7 @@ public List routes() { @Override protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException { - IndexRequest indexRequest = new IndexRequest(".net-new-system-index-" + Version.CURRENT.major); + IndexRequest indexRequest = new IndexRequest(".net-new-system-index-primary"); indexRequest.source(request.requiredContent(), request.getXContentType()); indexRequest.id(request.param("id")); indexRequest.setRefreshPolicy(request.param("refresh")); diff --git a/server/src/main/java/org/elasticsearch/common/logging/HeaderWarning.java b/server/src/main/java/org/elasticsearch/common/logging/HeaderWarning.java index 20ed4611106ac..090f126fcaa9c 100644 --- a/server/src/main/java/org/elasticsearch/common/logging/HeaderWarning.java +++ b/server/src/main/java/org/elasticsearch/common/logging/HeaderWarning.java @@ -117,8 +117,9 @@ static Pattern getPatternWithoutSemanticVersion() { * three-digit number with various standard warn codes specified. The warn code 299 is apt for our purposes as it represents a * miscellaneous persistent warning (can be presented to a human, or logged, and must not be removed by a cache). The warn-agent is an * arbitrary token; here we use the Elasticsearch version and build hash, if the version is semantic, or just the hash, if it is not - * semantic (e.g. in serverless). The warn text must be quoted. The warn-date is an optional quoted field that can be in a variety of - * specified date formats; here we use RFC 1123 format. + * semantic (e.g. overridden with an arbitrary string by a org.elasticsearch.internal.BuildExtension implementation). + * The warn text must be quoted. The warn-date is an optional quoted field that can be in a variety of specified date formats; here we + * use RFC 1123 format. */ private static final String WARNING_PREFIX = buildWarningPrefix(); @@ -205,6 +206,7 @@ public static void removeThreadContext(ThreadContext threadContext) { * {@code 299 Elasticsearch-6.0.0 "warning value"}, the return value of this method would be {@code warning value}. * * @param s the value of a warning header formatted according to RFC 7234. + * @param stripXContentPosition whether to remove XContent location information or not * @return the extracted warning value */ public static String extractWarningValueFromWarningHeader(final String s, boolean stripXContentPosition) {