Package org.xbib.elasticsearch.action.admin.indices.reconstruct

Examples of org.xbib.elasticsearch.action.admin.indices.reconstruct.ReconstructIndexRequest


        controller.registerHandler(GET, "/{index}/_skywalker/reconstruct", this);
    }

    @Override
    public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
        ReconstructIndexRequest r = new ReconstructIndexRequest(request.param("index"));
        client.admin().indices().execute(ReconstructIndexAction.INSTANCE, r, new RestResponseListener<ReconstructIndexResponse>(channel) {
            @Override
            public RestResponse buildResponse(ReconstructIndexResponse response) throws Exception {
                XContentBuilder builder = jsonBuilder();
                builder.startObject()
                        .field("ok", true)
                        .field("index", request.param("index"))
                        .startArray("shards");
                for (ShardReconstructIndexResponse r : response.shards()) {
                    XContentParser p = XContentHelper.createParser(r.getReconstructedIndex().bytes());
                    builder.copyCurrentStructure(p);
                }
                builder.endArray();
                builder.endObject();
                return new BytesRestResponse(OK, builder);
View Full Code Here

TOP

Related Classes of org.xbib.elasticsearch.action.admin.indices.reconstruct.ReconstructIndexRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.