Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 7 additions & 2 deletions docs/reference/migration/apis/assistance.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
<titleabbrev>Migration assistance</titleabbrev>
++++

The Migration Assistance API analyzes existing indices in the cluster and
returns the information about indices that require some changes before the
IMPORTANT: The Migration Assistance API is deprecated, use the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone uses this API in 6.7, will it return correct information ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a tweak to this to make sure the behavior aligns, but as of this PR, if used in 6.7, this API will correctly identify which indices need to be reindexed, including internal indices. It will only say that indices need to be "upgraded" if they were not properly upgraded before upgrading the cluster to 6 and need to be fixed using the Migration Upgrade API.

<<migration-api-deprecation,Deprecation Info API>> instead, which provides more
complete and detailed information about actions necessary prior to upgrade.

deprecated[6.7, Use the <<migration-api-deprecation,Deprecation Info API>>
instead.] The Migration Assistance API analyzes existing indices in the cluster
and returns the information about indices that require some changes before the
cluster can be upgraded to the next major version.

[float]
Expand Down
10 changes: 8 additions & 2 deletions docs/reference/migration/apis/upgrade.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
<titleabbrev>Migration upgrade</titleabbrev>
++++

The Migration Upgrade API performs the upgrade of internal indices to make them
compatible with the next major version.
IMPORTANT: To prepare a cluster for an upgrade to Elasticsearch version 7, use
the {kibana-ref}/upgrade-assistant.html[{kib} Upgrade Assistant] or
<<reindex-upgrade,Reindex manually>> before upgrading.

deprecated[6.7, Use the {kibana-ref}/upgrade-assistant.html[{kib} Upgrade
Assistant] or <<reindex-upgrade,Reindex manually>> before upgrading.] The
Migration Upgrade API performs the upgrade of internal indices to make them
compatible with version 6 of Elasticsearch.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone uses this API in 6.7 will it work correctly ?

Copy link
Contributor Author

@gwbrown gwbrown Mar 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a tweak to this to make sure the behavior aligns, but as of this PR, if used in 6.7, the Upgrade API will only upgrade indices that need to be upgraded from their 5.x format (i.e. they were not upgraded before upgrading the cluster). Otherwise, it will just say that the index needs to be reindexed.

That is, if the .watches-6 index was created and upgraded in 5.x, the Upgrade API will refuse to upgrade it and just say that it needs to be reindexed.


[float]
==== Request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ setup:

---
"Upgrade info - all":
- skip:
version: " - 6.6.99"
reason: Deprecated in 6.7.0, will not issue warnings before 6.7.0
features: "warnings"
- do:
warnings:
- "[GET _xpack/migration/assistance/{index}] is deprecated. Use [GET _xpack/migration/deprecations?index={index}] instead."
xpack.migration.get_assistance: { index: _all }

- length: { indices: 0 }
Expand All @@ -39,8 +45,13 @@ setup:

---
"Upgrade test - wait_for_completion:false":

- skip:
version: " - 6.6.99"
reason: Deprecated in 6.7.0, will not issue warnings before 6.7.0
features: "warnings"
- do:
warnings:
- "[_xpack/migration/upgrade] is deprecated. Use the Kibana Upgrade Assistant or the Reindex API instead."
xpack.migration.upgrade:
index: test1
wait_for_completion: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
*/
package org.elasticsearch.xpack.upgrade.rest;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
Expand All @@ -32,9 +35,14 @@
import java.util.Map;

public class RestIndexUpgradeAction extends BaseRestHandler {
private static final Logger logger = LogManager.getLogger(RestIndexUpgradeAction.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);

public RestIndexUpgradeAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.POST, "_xpack/migration/upgrade/{index}", this);
controller.registerAsDeprecatedHandler(RestRequest.Method.POST, "_xpack/migration/upgrade/{index}", this,
"[_xpack/migration/upgrade] is deprecated. Use the Kibana Upgrade Assistant or the Reindex API instead.",
deprecationLogger);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
*/
package org.elasticsearch.xpack.upgrade.rest;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.protocol.xpack.migration.IndexUpgradeInfoRequest;
import org.elasticsearch.rest.BaseRestHandler;
Expand All @@ -19,11 +22,17 @@
import java.io.IOException;

public class RestIndexUpgradeInfoAction extends BaseRestHandler {
private static final Logger logger = LogManager.getLogger(RestIndexUpgradeInfoAction.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);

public RestIndexUpgradeInfoAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.GET, "/_xpack/migration/assistance", this);
controller.registerHandler(RestRequest.Method.GET, "/_xpack/migration/assistance/{index}", this);
controller.registerAsDeprecatedHandler(RestRequest.Method.GET, "/_xpack/migration/assistance", this,
"[GET _xpack/migration/assistance] is deprecated. " +
"Use [GET _xpack/migration/deprecations] instead.", deprecationLogger);
controller.registerAsDeprecatedHandler(RestRequest.Method.GET, "/_xpack/migration/assistance/{index}", this,
"[GET _xpack/migration/assistance/{index}] is deprecated. " +
"Use [GET _xpack/migration/deprecations?index={index}] instead.", deprecationLogger);
}

@Override
Expand Down