From cb88e7ed038110f5cd1053d1d98a20d91fc55909 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 13 Feb 2019 14:43:35 -0800 Subject: [PATCH 1/2] Update the removal of types docs with the new 6.7 behavior. (#38869) Follow-up to #38825, where we made a tweak to the deprecation behavior. --- .../mapping/removal_of_types.asciidoc | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/reference/mapping/removal_of_types.asciidoc b/docs/reference/mapping/removal_of_types.asciidoc index db8b3a3d17c53..ab6bfb39d8d04 100644 --- a/docs/reference/mapping/removal_of_types.asciidoc +++ b/docs/reference/mapping/removal_of_types.asciidoc @@ -259,9 +259,10 @@ Elasticsearch 6.x:: * In 6.7, the index creation, index template, and mapping APIs support a query string parameter (`include_type_name`) which indicates whether requests and - responses should include a type name. It defaults to `true`, and not setting - `include_type_name=false` will result in a deprecation warning. Indices which - don't have an explicit type will use the dummy type name `_doc`. + responses should include a type name. It defaults to `true`, and should be set + to an explicit value to prepare to upgrade to 7.0. Not setting `include_type_name` + will result in a deprecation warning. Indices which don't have an explicit type will + use the dummy type name `_doc`. Elasticsearch 7.x:: @@ -271,8 +272,8 @@ Elasticsearch 7.x:: for auto-generated ids. * The `include_type_name` parameter in the index creation, index template, - and mapping APIs will default to `false`. Setting the parameter will result - in a deprecation warning. + and mapping APIs will default to `false`. Setting the parameter at all will + result in a deprecation warning. * The `_default_` mapping type is removed. @@ -438,12 +439,16 @@ documents to it using typeless `index` calls, and load documents with typeless ==== Indices APIs Index creation, index template, and mapping APIs support a new `include_type_name` -url parameter that specifies whether mapping definitions in requests and responses +URL parameter that specifies whether mapping definitions in requests and responses should contain the type name. The parameter defaults to `true` in version 6.7 to match the pre-7.0 behavior of using type names in mappings. It defaults to `false` in version 7.0 and will be removed in version 8.0. -See some examples of interactions with Elasticsearch with this option provided: +It should be set explicitly in 6.7 to prepare to upgrade to 7.0. To avoid deprecation +warnings in 6.7, the parameter can be set to either `true` or `false`. In 7.0, setting +`include_type_name` at all will result in a deprecation warning. + +See some examples of interactions with Elasticsearch with this option set to `false`: [source,js] -------------------------------------------------- @@ -631,8 +636,9 @@ GET index/_doc/1 [float] ==== Index templates -It is recommended to make index templates typeless before upgrading to 7.0 by -re-adding them with `include_type_name` set to `false`. +It is recommended to make index templates typeless by re-adding them with +`include_type_name` set to `false`. Under the hood, typeless templates will use +the dummy type `_doc` when creating indices. In case typeless templates are used with typed index creation calls or typed templates are used with typeless index creation calls, the template will still From 70e5a726aafac60d3d22da78f6b8b46d5b484fe6 Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Wed, 13 Feb 2019 16:13:14 -0700 Subject: [PATCH 2/2] Only flush Watcher's bulk processor if Watcher is enabled (#38803) When shutting down Watcher, the `bulkProcessor` is null if watcher has been disabled in the configuration. This protects the flush and close calls with a check for watcher enabled to avoid a NullPointerException Resolves #38798 --- .../main/java/org/elasticsearch/xpack/watcher/Watcher.java | 6 ++++-- .../org/elasticsearch/xpack/watcher/WatcherPluginTests.java | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java index 6648241d82a3b..1519085a3accd 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java @@ -669,10 +669,12 @@ public List> getContexts() { @Override public void close() throws IOException { - bulkProcessor.flush(); + if (enabled) { + bulkProcessor.flush(); + } IOUtils.closeWhileHandlingException(httpClient); try { - if (bulkProcessor.awaitClose(10, TimeUnit.SECONDS) == false) { + if (enabled && bulkProcessor.awaitClose(10, TimeUnit.SECONDS) == false) { logger.warn("failed to properly close watcher bulk processor"); } } catch (InterruptedException e) { diff --git a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginTests.java b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginTests.java index b13b035304d7c..a4131889f84a0 100644 --- a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginTests.java +++ b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginTests.java @@ -81,6 +81,8 @@ public void testWatcherDisabledTests() throws Exception { // also no component creation if not enabled assertThat(watcher.createComponents(null, null, null, null, null, null, null, null, null), hasSize(0)); + + watcher.close(); } public void testThreadPoolSize() {