Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the suggest metric from stats APIs #29635

Merged
merged 3 commits into from
Apr 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<<write-thread-pool-fallback, Removed `thread_pool.bulk.*` settings and
`es.thread_pool.write.use_bulk_as_display_name` system property>> ({pull}29609[#29609])

<<remove-suggest-metric, Removed `suggest` metric on stats APIs>> ({pull}29635[#29635])

=== Breaking Java Changes

=== Deprecations
Expand Down
9 changes: 8 additions & 1 deletion docs/reference/migration/migrate_7_0/api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ public CommonStats(CommonStatsFlags flags) {
case Translog:
translog = new TranslogStats();
break;
case Suggest:
// skip
break;
case RequestCache:
requestCache = new RequestCacheStats();
break;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
for (final String indexMetric : indexMetrics) {
final Consumer<CommonStatsFlags> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -102,9 +101,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
for (final String metric : metrics) {
final Consumer<IndicesStatsRequest> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> 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]" );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> 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]");
}

}