• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ForceMergeResponse类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse的典型用法代码示例。如果您正苦于以下问题:Java ForceMergeResponse类的具体用法?Java ForceMergeResponse怎么用?Java ForceMergeResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ForceMergeResponse类属于org.elasticsearch.action.admin.indices.forcemerge包,在下文中一共展示了ForceMergeResponse类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: afterLoad

点赞 3

import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; //导入依赖的package包/类
@Override
protected void afterLoad() throws InterruptedException {
    if (bulkProcessor != null) {
        logger.info(marker, "Waiting for transport to serialize all remaining documents.");

        if (!bulkProcessor.awaitClose(120, TimeUnit.MINUTES)) {
            logger.warn(marker, "Closing time expired BEFORE sending all documents!");
        }

        logger.info(marker, "Optimizing index for reading..");
        ForceMergeResponse res = esClient.prepareForceMerge().get();
        if (res.getFailedShards() != 0) {
            logger.warn(marker, "An error was detected during optimizaton. Check logs.");
        }

        if (!indexRequests.isEmpty()) {
            logger.warn(marker, "Still pending {} index requests?", indexRequests.size()); // should not happen
            indexRequests.clear();
        }
    }
}
 

开发者ID:Lambda-3,
项目名称:Stargraph,
代码行数:22,
代码来源:ElasticIndexer.java

示例2: prepareRequest

点赞 3

import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    ForceMergeRequest mergeRequest = new ForceMergeRequest(Strings.splitStringByCommaToArray(request.param("index")));
    mergeRequest.indicesOptions(IndicesOptions.fromRequest(request, mergeRequest.indicesOptions()));
    mergeRequest.maxNumSegments(request.paramAsInt("max_num_segments", mergeRequest.maxNumSegments()));
    mergeRequest.onlyExpungeDeletes(request.paramAsBoolean("only_expunge_deletes", mergeRequest.onlyExpungeDeletes()));
    mergeRequest.flush(request.paramAsBoolean("flush", mergeRequest.flush()));
    return channel -> client.admin().indices().forceMerge(mergeRequest, new RestBuilderListener<ForceMergeResponse>(channel) {
        @Override
        public RestResponse buildResponse(ForceMergeResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            buildBroadcastShardsHeader(builder, request, response);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:18,
代码来源:RestForceMergeAction.java

示例3: handleRequest

点赞 3

import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; //导入依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    ForceMergeRequest mergeRequest = new ForceMergeRequest(Strings.splitStringByCommaToArray(request.param("index")));
    mergeRequest.indicesOptions(IndicesOptions.fromRequest(request, mergeRequest.indicesOptions()));
    mergeRequest.maxNumSegments(request.paramAsInt("max_num_segments", mergeRequest.maxNumSegments()));
    mergeRequest.onlyExpungeDeletes(request.paramAsBoolean("only_expunge_deletes", mergeRequest.onlyExpungeDeletes()));
    mergeRequest.flush(request.paramAsBoolean("flush", mergeRequest.flush()));
    client.admin().indices().forceMerge(mergeRequest, new RestBuilderListener<ForceMergeResponse>(channel) {
        @Override
        public RestResponse buildResponse(ForceMergeResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            buildBroadcastShardsHeader(builder, request, response);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 

开发者ID:baidu,
项目名称:Elasticsearch,
代码行数:18,
代码来源:RestForceMergeAction.java

示例4: forceMerge

点赞 3

import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; //导入依赖的package包/类
public ForceMergeResponse forceMerge(
        final BuilderCallback<ForceMergeRequestBuilder> builder) {
    waitForRelocation();
    final ForceMergeResponse actionGet = builder
            .apply(client().admin().indices().prepareForceMerge()).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;
}
 

开发者ID:codelibs,
项目名称:elasticsearch-cluster-runner,
代码行数:18,
代码来源:ElasticsearchClusterRunner.java

示例5: forceMerge

点赞 2

import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; //导入依赖的package包/类
/**
 * Waits for all relocations and force merge all indices in the cluster to 1 segment.
 */
protected ForceMergeResponse forceMerge() {
    waitForRelocation();
    ForceMergeResponse actionGet = client().admin().indices().prepareForceMerge().setMaxNumSegments(1).execute().actionGet();
    assertNoFailures(actionGet);
    return actionGet;
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:10,
代码来源:ESIntegTestCase.java

示例6: testPrunedSegments

点赞 2

import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; //导入依赖的package包/类
public void testPrunedSegments() throws IOException {
    createIndexAndMappingAndSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0).build(), completionMappingBuilder);

    client().prepareIndex(INDEX, TYPE, "1").setSource(jsonBuilder()
            .startObject().startObject(FIELD)
            .startArray("input").value("The Beatles").endArray()
            .endObject().endObject()
    ).get();
    client().prepareIndex(INDEX, TYPE, "2").setSource(jsonBuilder()
            .startObject()
            .field("somefield", "somevalue")
            .endObject()
    ).get(); // we have 2 docs in a segment...
    ForceMergeResponse actionGet = client().admin().indices().prepareForceMerge().setFlush(true).setMaxNumSegments(1).execute().actionGet();
    assertAllSuccessful(actionGet);
    refresh();
    // update the first one and then merge.. the target segment will have no value in FIELD
    client().prepareIndex(INDEX, TYPE, "1").setSource(jsonBuilder()
            .startObject()
            .field("somefield", "somevalue")
            .endObject()
    ).get();
    actionGet = client().admin().indices().prepareForceMerge().setFlush(true).setMaxNumSegments(1).execute().actionGet();
    assertAllSuccessful(actionGet);
    refresh();

    assertSuggestions("b");
    assertThat(2L, equalTo(client().prepareSearch(INDEX).setSize(0).get().getHits().getTotalHits()));
    for (IndexShardSegments seg : client().admin().indices().prepareSegments().get().getIndices().get(INDEX)) {
        ShardSegments[] shards = seg.getShards();
        for (ShardSegments shardSegments : shards) {
            assertThat(shardSegments.getSegments().size(), equalTo(1));
        }
    }
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:36,
代码来源:CompletionSuggestSearchIT.java

示例7: forceMerge

点赞 2

import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; //导入依赖的package包/类
@Override
public ActionFuture<ForceMergeResponse> forceMerge(final ForceMergeRequest request) {
    return execute(ForceMergeAction.INSTANCE, request);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:5,
代码来源:AbstractClient.java

示例8: forceMerge

点赞 1

import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; //导入依赖的package包/类
/**
 * Explicitly force merge one or more indices into a the number of segments.
 *
 * @param request The optimize request
 * @return A result future
 * @see org.elasticsearch.client.Requests#forceMergeRequest(String...)
 */
ActionFuture<ForceMergeResponse> forceMerge(ForceMergeRequest request);
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:9,
代码来源:IndicesAdminClient.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)