Package org.elasticsearch.action.admin.indices.optimize

Examples of org.elasticsearch.action.admin.indices.optimize.OptimizeRequest


            }
        });
    }
   
    void handlePost(RestRequest request, RestChannel channel, Client client) {
        OptimizeRequest optimizeReq = new OptimizeRequest(Strings.splitStringByCommaToArray(request.param("index")));
        optimizeReq.waitForMerge(request.paramAsBoolean("wait_for_completion", false));
        optimizeReq.flush(true);
        optimizeReq.upgrade(true);
        optimizeReq.maxNumSegments(Integer.MAX_VALUE); // we just want to upgrade the segments, not actually optimize to a single segment
        client.admin().indices().optimize(optimizeReq, new RestBuilderListener<OptimizeResponse>(channel) {
            @Override
            public RestResponse buildResponse(OptimizeResponse response, XContentBuilder builder) throws Exception {
                builder.startObject();
                buildBroadcastShardsHeader(builder, response);
View Full Code Here


    @Test
    public void testOptimize() {
        String optimizeShardAction = OptimizeAction.NAME + "[s]";
        interceptTransportActions(optimizeShardAction);

        OptimizeRequest optimizeRequest = new OptimizeRequest(randomIndicesOrAliases());
        internalCluster().clientNodeClient().admin().indices().optimize(optimizeRequest).actionGet();

        clearInterceptedActions();
        assertSameIndices(optimizeRequest, optimizeShardAction);
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.admin.indices.optimize.OptimizeRequest

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.