org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse Java Examples

The following examples show how to use org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestUpgradeAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
void handlePost(final RestRequest request, RestChannel channel, Client client) {
    UpgradeRequest upgradeReq = new UpgradeRequest(Strings.splitStringByCommaToArray(request.param("index")));
    upgradeReq.upgradeOnlyAncientSegments(request.paramAsBoolean("only_ancient_segments", false));
    client.admin().indices().upgrade(upgradeReq, new RestBuilderListener<UpgradeResponse>(channel) {
        @Override
        public RestResponse buildResponse(UpgradeResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            buildBroadcastShardsHeader(builder, request, response);
            builder.startObject("upgraded_indices");
            for (Map.Entry<String, Tuple<Version, String>> entry : response.versions().entrySet()) {
                builder.startObject(entry.getKey(), XContentBuilder.FieldCaseConversion.NONE);
                builder.field("upgrade_version", entry.getValue().v1());
                builder.field("oldest_lucene_segment_version", entry.getValue().v2());
                builder.endObject();
            }
            builder.endObject();
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 
Example #2
Source File: ElasticsearchClusterRunner.java    From elasticsearch-cluster-runner with Apache License 2.0 5 votes vote down vote up
public UpgradeResponse upgrade(final BuilderCallback<UpgradeRequestBuilder> builder) {
    waitForRelocation();
    final UpgradeResponse actionGet = builder.apply(client().admin().indices().prepareUpgrade()).execute().actionGet();
    final ShardOperationFailedException[] shardFailures = actionGet.getShardFailures();
    if (shardFailures != null && shardFailures.length != 0) {
        final StringBuilder buf = new StringBuilder(100);
        for (final ShardOperationFailedException shardFailure : shardFailures) {
            buf.append(shardFailure.toString()).append('\n');
        }
        onFailure(buf.toString(), actionGet);
    }
    return actionGet;
}
 
Example #3
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<UpgradeResponse> upgrade(final UpgradeRequest request) {
    return execute(UpgradeAction.INSTANCE, request);
}
 
Example #4
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void upgrade(final UpgradeRequest request, final ActionListener<UpgradeResponse> listener) {
    execute(UpgradeAction.INSTANCE, request, listener);
}
 
Example #5
Source File: ElasticsearchClusterRunner.java    From elasticsearch-cluster-runner with Apache License 2.0 4 votes vote down vote up
public UpgradeResponse upgrade() {
    return upgrade(true);
}
 
Example #6
Source File: ElasticsearchClusterRunner.java    From elasticsearch-cluster-runner with Apache License 2.0 4 votes vote down vote up
public UpgradeResponse upgrade(final boolean upgradeOnlyAncientSegments) {
    return upgrade(builder -> builder.setUpgradeOnlyAncientSegments(upgradeOnlyAncientSegments));
}
 
Example #7
Source File: AbstractClient.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<UpgradeResponse> upgrade(final UpgradeRequest request) {
    return execute(UpgradeAction.INSTANCE, request);
}
 
Example #8
Source File: AbstractClient.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public void upgrade(final UpgradeRequest request, final ActionListener<UpgradeResponse> listener) {
    execute(UpgradeAction.INSTANCE, request, listener);
}
 
Example #9
Source File: IndicesAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Explicitly upgrade one or more indices
 *
 * @param request The upgrade request
 * @return A result future
 * @see org.elasticsearch.client.Requests#upgradeRequest(String...)
 */
ActionFuture<UpgradeResponse> upgrade(UpgradeRequest request);
 
Example #10
Source File: IndicesAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Explicitly upgrade one or more indices
 *
 * @param request  The upgrade request
 * @param listener A listener to be notified with a result
 * @see org.elasticsearch.client.Requests#upgradeRequest(String...)
 */
void upgrade(UpgradeRequest request, ActionListener<UpgradeResponse> listener);
 
Example #11
Source File: IndicesAdminClient.java    From crate with Apache License 2.0 2 votes vote down vote up
/**
 * Explicitly upgrade one or more indices
 *
 * @param request The upgrade request
 * @return A result future
 * @see org.elasticsearch.client.Requests#upgradeRequest(String...)
 */
ActionFuture<UpgradeResponse> upgrade(UpgradeRequest request);
 
Example #12
Source File: IndicesAdminClient.java    From crate with Apache License 2.0 2 votes vote down vote up
/**
 * Explicitly upgrade one or more indices
 *
 * @param request  The upgrade request
 * @param listener A listener to be notified with a result
 * @see org.elasticsearch.client.Requests#upgradeRequest(String...)
 */
void upgrade(UpgradeRequest request, ActionListener<UpgradeResponse> listener);