Skip to content

Commit

Permalink
Remove Migration Upgrade and Assistance APIs (elastic#40075)
Browse files Browse the repository at this point in the history
The Migration Assistance API has been functionally replaced by the
Deprecation Info API, and the Migration Upgrade API is not used for the
transition from ES 6.x to 7.x, and does not need to be kept around to
repair indices that were not properly upgraded before upgrading the
cluster, as was the case in 6.
  • Loading branch information
gwbrown committed Mar 15, 2019
1 parent 86d1d03 commit 7b7c1e5
Show file tree
Hide file tree
Showing 45 changed files with 44 additions and 3,035 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@

package org.elasticsearch.client;

import org.elasticsearch.action.ActionListener;
import org.elasticsearch.client.migration.DeprecationInfoRequest;
import org.elasticsearch.client.migration.DeprecationInfoResponse;
import org.elasticsearch.client.migration.IndexUpgradeInfoRequest;
import org.elasticsearch.client.migration.IndexUpgradeInfoResponse;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.client.tasks.TaskSubmissionResponse;
import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.client.migration.IndexUpgradeRequest;


import java.io.IOException;
import java.util.Collections;
Expand All @@ -47,34 +41,6 @@ public final class MigrationClient {
this.restHighLevelClient = restHighLevelClient;
}

/**
* Get Migration Assistance for one or more indices
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public IndexUpgradeInfoResponse getAssistance(IndexUpgradeInfoRequest request, RequestOptions options) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(request, MigrationRequestConverters::getMigrationAssistance, options,
IndexUpgradeInfoResponse::fromXContent, Collections.emptySet());
}

public BulkByScrollResponse upgrade(IndexUpgradeRequest request, RequestOptions options) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(request, MigrationRequestConverters::migrate, options,
BulkByScrollResponse::fromXContent, Collections.emptySet());
}

public TaskSubmissionResponse submitUpgradeTask(IndexUpgradeRequest request, RequestOptions options) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(request, MigrationRequestConverters::submitMigrateTask, options,
TaskSubmissionResponse::fromXContent, Collections.emptySet());
}

public void upgradeAsync(IndexUpgradeRequest request, RequestOptions options, ActionListener<BulkByScrollResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(request, MigrationRequestConverters::migrate, options,
BulkByScrollResponse::fromXContent, listener, Collections.emptySet());
}

/**
* Get deprecation info for one or more indices
* @param request the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,13 @@
package org.elasticsearch.client;

import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.elasticsearch.client.migration.DeprecationInfoRequest;
import org.elasticsearch.client.migration.IndexUpgradeInfoRequest;
import org.elasticsearch.client.migration.IndexUpgradeRequest;

final class MigrationRequestConverters {

private MigrationRequestConverters() {
}

static Request getMigrationAssistance(IndexUpgradeInfoRequest indexUpgradeInfoRequest) {
RequestConverters.EndpointBuilder endpointBuilder = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_migration", "assistance")
.addCommaSeparatedPathParts(indexUpgradeInfoRequest.indices());
String endpoint = endpointBuilder.build();
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params(request);
parameters.withIndicesOptions(indexUpgradeInfoRequest.indicesOptions());
return request;
}

static Request migrate(IndexUpgradeRequest indexUpgradeRequest) {
return prepareMigrateRequest(indexUpgradeRequest, true);
}

static Request submitMigrateTask(IndexUpgradeRequest indexUpgradeRequest) {
return prepareMigrateRequest(indexUpgradeRequest, false);
}

static Request getDeprecationInfo(DeprecationInfoRequest deprecationInfoRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addCommaSeparatedPathParts(deprecationInfoRequest.getIndices())
Expand All @@ -57,18 +35,4 @@ static Request getDeprecationInfo(DeprecationInfoRequest deprecationInfoRequest)

return new Request(HttpGet.METHOD_NAME, endpoint);
}

private static Request prepareMigrateRequest(IndexUpgradeRequest indexUpgradeRequest, boolean waitForCompletion) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_migration", "upgrade")
.addPathPart(indexUpgradeRequest.index())
.build();

Request request = new Request(HttpPost.METHOD_NAME, endpoint);

RequestConverters.Params params = new RequestConverters.Params(request)
.withWaitForCompletion(waitForCompletion);

return request;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@
import org.elasticsearch.search.aggregations.bucket.filter.ParsedFilter;
import org.elasticsearch.search.aggregations.bucket.filter.ParsedFilters;
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGridAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoTileGridAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.geogrid.ParsedGeoHashGrid;
import org.elasticsearch.search.aggregations.bucket.geogrid.ParsedGeoTileGrid;
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoTileGridAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.global.ParsedGlobal;
import org.elasticsearch.search.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder;
Expand Down Expand Up @@ -428,7 +428,7 @@ public IndexLifecycleClient indexLifecycle() {
}

/**
* Provides methods for accessing the Elastic Licensed Licensing APIs that
* Provides methods for accessing the Elastic Licensed Migration APIs that
* are shipped with the default distribution of Elasticsearch. All of
* these APIs will 404 if run against the OSS distribution of Elasticsearch.
* <p>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7b7c1e5

Please sign in to comment.