diff --git a/docs/CHANGELOG.asciidoc b/docs/CHANGELOG.asciidoc index b1cb9c3a4f57a..fde295b56ba72 100644 --- a/docs/CHANGELOG.asciidoc +++ b/docs/CHANGELOG.asciidoc @@ -12,6 +12,8 @@ <> ({pull}29609[#29609]) +<> ({pull}29635[#29635]) + === Breaking Java Changes === Deprecations diff --git a/docs/reference/migration/migrate_7_0/api.asciidoc b/docs/reference/migration/migrate_7_0/api.asciidoc index ec4778f9aa691..2da822a7e5e62 100644 --- a/docs/reference/migration/migrate_7_0/api.asciidoc +++ b/docs/reference/migration/migrate_7_0/api.asciidoc @@ -22,7 +22,14 @@ The following parameters starting with underscore have been removed: Instead of these removed parameters, use their non camel case equivalents without starting underscore, e.g. use `version_type` instead of `_version_type` or `versionType`. - ==== The parameter `fields` deprecated in 6.x has been removed from Bulk request and Update request. The Update API returns `400 - Bad request` if request contains unknown parameters (instead of ignored in the previous version). + +[[remove-suggest-metric]] +==== Remove support for `suggest` metric/index metric in indices stats and nodes stats APIs + +Previously, `suggest` stats were folded into `search` stats. Support for the +`suggest` metric on the indices stats and nodes stats APIs remained for +backwards compatibility. Backwards support for the `suggest` metric was +deprecated in 6.3.0 and now removed in 7.0.0. diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStats.java b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStats.java index 6379f8da21aa2..e244369c0c312 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStats.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStats.java @@ -152,9 +152,6 @@ public CommonStats(CommonStatsFlags flags) { case Translog: translog = new TranslogStats(); break; - case Suggest: - // skip - break; case RequestCache: requestCache = new RequestCacheStats(); break; @@ -213,9 +210,6 @@ public CommonStats(IndicesQueryCache indicesQueryCache, IndexShard indexShard, C case Translog: translog = indexShard.translogStats(); break; - case Suggest: - // skip - break; case RequestCache: requestCache = indexShard.requestCache().stats(); break; diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStatsFlags.java b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStatsFlags.java index b222fed7f0fff..a53cc0b339de8 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStatsFlags.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStatsFlags.java @@ -221,7 +221,7 @@ public enum Flag { Completion("completion", 11), Segments("segments", 12), Translog("translog", 13), - Suggest("suggest", 14), // unused + // 14 was previously used for Suggest RequestCache("request_cache", 15), Recovery("recovery", 16); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java index e4357f7ba126c..9f401b6312c46 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java @@ -229,15 +229,6 @@ public boolean translog() { return flags.isSet(Flag.Translog); } - public IndicesStatsRequest suggest(boolean suggest) { - flags.set(Flag.Suggest, suggest); - return this; - } - - public boolean suggest() { - return flags.isSet(Flag.Suggest); - } - public IndicesStatsRequest requestCache(boolean requestCache) { flags.set(Flag.RequestCache, requestCache); return this; diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/TransportIndicesStatsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/TransportIndicesStatsAction.java index 50d7712da11d0..eeefe793db701 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/TransportIndicesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/TransportIndicesStatsAction.java @@ -148,9 +148,6 @@ protected ShardStats shardOperation(IndicesStatsRequest request, ShardRouting sh if (request.translog()) { flags.set(CommonStatsFlags.Flag.Translog); } - if (request.suggest()) { - flags.set(CommonStatsFlags.Flag.Suggest); - } if (request.requestCache()) { flags.set(CommonStatsFlags.Flag.RequestCache); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java index 624f7d1b9dcda..14c8655e48c18 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java @@ -146,10 +146,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC for (final String indexMetric : indexMetrics) { final Consumer handler = FLAGS.get(indexMetric); if (handler != null) { - if ("suggest".equals(indexMetric)) { - deprecationLogger.deprecated( - "the suggest index metric is deprecated on the nodes stats API [" + request.uri() + "]"); - } handler.accept(flags); } else { invalidIndexMetrics.add(indexMetric); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java index f868a8d6c4397..fd70b7461ec67 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java @@ -62,7 +62,6 @@ public String getName() { metrics.put("store", r -> r.store(true)); metrics.put("indexing", r -> r.indexing(true)); metrics.put("search", r -> r.search(true)); - metrics.put("suggest", r -> r.search(true)); metrics.put("get", r -> r.get(true)); metrics.put("merge", r -> r.merge(true)); metrics.put("refresh", r -> r.refresh(true)); @@ -102,9 +101,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC for (final String metric : metrics) { final Consumer consumer = METRICS.get(metric); if (consumer != null) { - if ("suggest".equals(metric)) { - deprecationLogger.deprecated("the suggest metric is deprecated on the indices stats API [" + request.uri() + "]"); - } consumer.accept(indicesStatsRequest); } else { invalidMetrics.add(metric); diff --git a/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java b/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java index ad2095a6dd073..4d0d0d6ff3fd9 100644 --- a/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java +++ b/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java @@ -589,10 +589,6 @@ public void testAllFlags() throws Exception { IndicesStatsResponse stats = builder.execute().actionGet(); for (Flag flag : values) { - if (flag == Flag.Suggest) { - // suggest flag is unused - continue; - } assertThat(isSet(flag, stats.getPrimaries()), equalTo(false)); assertThat(isSet(flag, stats.getTotal()), equalTo(false)); } @@ -628,10 +624,6 @@ public void testAllFlags() throws Exception { } for (Flag flag : EnumSet.complementOf(flags)) { // check the complement - if (flag == Flag.Suggest) { - // suggest flag is unused - continue; - } assertThat(isSet(flag, stats.getPrimaries()), equalTo(false)); assertThat(isSet(flag, stats.getTotal()), equalTo(false)); } @@ -684,7 +676,7 @@ public void testEncodeDecodeCommonStats() throws IOException { public void testFlagOrdinalOrder() { Flag[] flags = new Flag[]{Flag.Store, Flag.Indexing, Flag.Get, Flag.Search, Flag.Merge, Flag.Flush, Flag.Refresh, Flag.QueryCache, Flag.FieldData, Flag.Docs, Flag.Warmer, Flag.Completion, Flag.Segments, - Flag.Translog, Flag.Suggest, Flag.RequestCache, Flag.Recovery}; + Flag.Translog, Flag.RequestCache, Flag.Recovery}; assertThat(flags.length, equalTo(Flag.values().length)); for (int i = 0; i < flags.length; i++) { @@ -935,8 +927,6 @@ private static void set(Flag flag, IndicesStatsRequestBuilder builder, boolean s case Translog: builder.setTranslog(set); break; - case Suggest: // unused - break; case RequestCache: builder.setRequestCache(set); break; @@ -979,8 +969,6 @@ private static boolean isSet(Flag flag, CommonStats response) { return response.getSegments() != null; case Translog: return response.getTranslog() != null; - case Suggest: // unused - return true; case RequestCache: return response.getRequestCache() != null; case Recovery: diff --git a/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java index 90e0cfa656b7e..f1d7686838cea 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java @@ -148,14 +148,4 @@ public void testIndexMetricsRequestOnAllRequest() throws IOException { containsString("request [/_nodes/stats] contains index metrics [" + indexMetric + "] but all stats requested"))); } - public void testSuggestIsDeprecated() throws IOException { - final Map params = - Stream.of(Tuple.tuple("metric", "indices"), Tuple.tuple("index_metric", "suggest")) - .collect(Collectors.toMap(Tuple::v1, Tuple::v2)); - final RestRequest request = - new FakeRestRequest.Builder(xContentRegistry()).withPath("/_nodes/stats").withParams(params).build(); - action.prepareRequest(request, mock(NodeClient.class)); - assertWarnings("the suggest index metric is deprecated on the nodes stats API [/_nodes/stats]" ); - } - } diff --git a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java index 38edbee673ee5..f9eb93b64bef2 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java @@ -84,11 +84,4 @@ public void testAllRequestWithOtherMetrics() throws IOException { assertThat(e, hasToString(containsString("request [/_stats] contains _all and individual metrics [_all," + metric + "]"))); } - public void testSuggestIsDeprecated() throws IOException { - final Map params = Collections.singletonMap("metric", "suggest"); - final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_stats").withParams(params).build(); - action.prepareRequest(request, mock(NodeClient.class)); - assertWarnings("the suggest metric is deprecated on the indices stats API [/_stats]"); - } - }