Search in sources :

Example 1 with UpgradeStatusResponse

use of org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse in project elasticsearch by elastic.

the class OldIndexUtils method getUpgradeStatus.

@SuppressWarnings("unchecked")
public static Collection<IndexUpgradeStatus> getUpgradeStatus(Client client, String... indices) throws Exception {
    UpgradeStatusResponse upgradeStatusResponse = client.admin().indices().prepareUpgradeStatus(indices).get();
    assertNoFailures(upgradeStatusResponse);
    return upgradeStatusResponse.getIndices().values();
}
Also used : UpgradeStatusResponse(org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse)

Example 2 with UpgradeStatusResponse

use of org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse in project elasticsearch by elastic.

the class RestUpgradeAction method handleGet.

private RestChannelConsumer handleGet(final RestRequest request, NodeClient client) {
    UpgradeStatusRequest statusRequest = new UpgradeStatusRequest(Strings.splitStringByCommaToArray(request.param("index")));
    statusRequest.indicesOptions(IndicesOptions.fromRequest(request, statusRequest.indicesOptions()));
    return channel -> client.admin().indices().upgradeStatus(statusRequest, new RestBuilderListener<UpgradeStatusResponse>(channel) {

        @Override
        public RestResponse buildResponse(UpgradeStatusResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            response.toXContent(builder, request);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
Also used : UpgradeRequest(org.elasticsearch.action.admin.indices.upgrade.post.UpgradeRequest) BaseRestHandler(org.elasticsearch.rest.BaseRestHandler) UpgradeStatusRequest(org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequest) GET(org.elasticsearch.rest.RestRequest.Method.GET) RestResponse(org.elasticsearch.rest.RestResponse) RestBuilderListener(org.elasticsearch.rest.action.RestBuilderListener) IOException(java.io.IOException) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) RestController(org.elasticsearch.rest.RestController) UpgradeStatusResponse(org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse) Strings(org.elasticsearch.common.Strings) BytesRestResponse(org.elasticsearch.rest.BytesRestResponse) POST(org.elasticsearch.rest.RestRequest.Method.POST) Version(org.elasticsearch.Version) Settings(org.elasticsearch.common.settings.Settings) RestActions.buildBroadcastShardsHeader(org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader) UpgradeResponse(org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse) Map(java.util.Map) IndicesOptions(org.elasticsearch.action.support.IndicesOptions) RestRequest(org.elasticsearch.rest.RestRequest) OK(org.elasticsearch.rest.RestStatus.OK) NodeClient(org.elasticsearch.client.node.NodeClient) Tuple(org.elasticsearch.common.collect.Tuple) UpgradeStatusResponse(org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse) UpgradeStatusRequest(org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequest) RestResponse(org.elasticsearch.rest.RestResponse) BytesRestResponse(org.elasticsearch.rest.BytesRestResponse) BytesRestResponse(org.elasticsearch.rest.BytesRestResponse) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) IOException(java.io.IOException)

Aggregations

UpgradeStatusResponse (org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse)2 IOException (java.io.IOException)1 Map (java.util.Map)1 Version (org.elasticsearch.Version)1 UpgradeStatusRequest (org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequest)1 UpgradeRequest (org.elasticsearch.action.admin.indices.upgrade.post.UpgradeRequest)1 UpgradeResponse (org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse)1 IndicesOptions (org.elasticsearch.action.support.IndicesOptions)1 NodeClient (org.elasticsearch.client.node.NodeClient)1 Strings (org.elasticsearch.common.Strings)1 Tuple (org.elasticsearch.common.collect.Tuple)1 Settings (org.elasticsearch.common.settings.Settings)1 XContentBuilder (org.elasticsearch.common.xcontent.XContentBuilder)1 BaseRestHandler (org.elasticsearch.rest.BaseRestHandler)1 BytesRestResponse (org.elasticsearch.rest.BytesRestResponse)1 RestController (org.elasticsearch.rest.RestController)1 RestRequest (org.elasticsearch.rest.RestRequest)1 GET (org.elasticsearch.rest.RestRequest.Method.GET)1 POST (org.elasticsearch.rest.RestRequest.Method.POST)1 RestResponse (org.elasticsearch.rest.RestResponse)1