• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ClearScrollResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: clearScroll

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
@Override
public void clearScroll(String scrollId, Runnable onCompletion) {
    ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
    clearScrollRequest.addScrollId(scrollId);
    /*
     * Unwrap the client so we don't set our task as the parent. If we *did* set our ID then the clear scroll would be cancelled as
     * if this task is cancelled. But we want to clear the scroll regardless of whether or not the main request was cancelled.
     */
    client.unwrap().clearScroll(clearScrollRequest, new ActionListener<ClearScrollResponse>() {
        @Override
        public void onResponse(ClearScrollResponse response) {
            logger.debug("Freed [{}] contexts", response.getNumFreed());
            onCompletion.run();
        }

        @Override
        public void onFailure(Exception e) {
            logger.warn((Supplier<?>) () -> new ParameterizedMessage("Failed to clear scroll [{}]", scrollId), e);
            onCompletion.run();
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:ClientScrollableHitSource.java


示例2: handleRequest

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    String scrollIds = request.param("scroll_id");
    ClearScrollRequest clearRequest = new ClearScrollRequest();
    clearRequest.setScrollIds(Arrays.asList(splitScrollIds(scrollIds)));
    if (RestActions.hasBodyContent(request)) {
        XContentType type = RestActions.guessBodyContentType(request);
       if (type == null) {
           scrollIds = RestActions.getRestContent(request).toUtf8();
           clearRequest.setScrollIds(Arrays.asList(splitScrollIds(scrollIds)));
       } else {
           // NOTE: if rest request with xcontent body has request parameters, these parameters does not override xcontent value
           clearRequest.setScrollIds(null);
           buildFromContent(RestActions.getRestContent(request), clearRequest);
       }
    }

    client.clearScroll(clearRequest, new RestStatusToXContentListener<ClearScrollResponse>(channel));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:20,代码来源:RestClearScrollAction.java


示例3: interrupt

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
public void interrupt() {
    interrupted.set(true);
    if (scrollId != null) {
        client.prepareClearScroll().addScrollId(scrollId)
                .execute(new ActionListener<ClearScrollResponse>() {

                    @Override
                    public void onResponse(ClearScrollResponse response) {
                        // nothing
                    }

                    @Override
                    public void onFailure(Throwable e) {
                        if (logger.isDebugEnabled()) {
                            logger.debug(
                                    "Failed to stop reindexing for "
                                            + toIndex + ".", e);
                        }
                    }
                });
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-reindexing,代码行数:23,代码来源:ReindexingService.java


示例4: testClearNonExistentScrollId

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
public void testClearNonExistentScrollId() throws Exception {
    createIndex("idx");
    ClearScrollResponse response = client().prepareClearScroll()
            .addScrollId("DnF1ZXJ5VGhlbkZldGNoAwAAAAAAAAABFnRtLWMyRzBqUUQyNk1uM0xDTjJ4S0EAAAAAAAAAARYzNkhxbWFTYVFVNmgxTGQyYUZVYV9nAAAAAAAAAAEWdVcxNWZmRGZSVFN2V0xMUGF2NGx1Zw==")
            .get();
    // Whether we actually clear a scroll, we can't know, since that information isn't serialized in the
    // free search context response, which is returned from each node we want to clear a particular scroll.
    assertThat(response.isSucceeded(), is(true));
    assertThat(response.getNumFreed(), equalTo(0));
    assertThat(response.status(), equalTo(RestStatus.NOT_FOUND));
    assertToXContentResponse(response, true, response.getNumFreed());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:SearchScrollIT.java


示例5: testThatNonExistingScrollIdReturnsCorrectException

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
public void testThatNonExistingScrollIdReturnsCorrectException() throws Exception {
    client().prepareIndex("index", "type", "1").setSource("field", "value").execute().get();
    refresh();

    SearchResponse searchResponse = client().prepareSearch("index").setSize(1).setScroll("1m").get();
    assertThat(searchResponse.getScrollId(), is(notNullValue()));

    ClearScrollResponse clearScrollResponse = client().prepareClearScroll().addScrollId(searchResponse.getScrollId()).get();
    assertThat(clearScrollResponse.isSucceeded(), is(true));

    assertThrows(internalCluster().transportClient().prepareSearchScroll(searchResponse.getScrollId()), RestStatus.NOT_FOUND);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:SearchScrollIT.java


示例6: assertToXContentResponse

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
private void assertToXContentResponse(ClearScrollResponse response, boolean succeed, int numFreed) throws IOException {
    XContentBuilder builder = XContentFactory.jsonBuilder();
    response.toXContent(builder, ToXContent.EMPTY_PARAMS);
    Map<String, Object> map = XContentHelper.convertToMap(builder.bytes(), false, builder.contentType()).v2();
    assertThat(map.get("succeeded"), is(succeed));
    assertThat(map.get("num_freed"), equalTo(numFreed));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:SearchScrollIT.java


示例7: close

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
@Override
public void close() throws IOException {
    if (response != null) {
        ClearScrollResponse clearScrollResponse = client.prepareClearScroll()
                .addScrollId(response.getScrollId())
                .execute()
                .actionGet();

        if (!clearScrollResponse.isSucceeded()) {
            LOGGER.debug("Failed to clear scroll: {}", clearScrollResponse.status());
        }
    }
}
 
开发者ID:nlpie,项目名称:nlptab,代码行数:14,代码来源:FsDataSource.java


示例8: clearScroll

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
/**
 * Clears the given scroll Ids
 */
public void clearScroll(String... scrollIds) {
    ClearScrollResponse clearResponse = client().prepareClearScroll()
        .setScrollIds(Arrays.asList(scrollIds)).get();
    assertThat(clearResponse.isSucceeded(), equalTo(true));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:ESIntegTestCase.java


示例9: clearScroll

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
@Override
public void clearScroll(ClearScrollRequest request, ActionListener<ClearScrollResponse> listener) {
    execute(ClearScrollAction.INSTANCE, request, listener);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java


示例10: clearScroll

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
@Override
public void clearScroll(ClearScrollRequest request,
		ActionListener<ClearScrollResponse> listener) {
	// TODO Auto-generated method stub

}
 
开发者ID:winterstein,项目名称:elasticsearch-java-client,代码行数:7,代码来源:DummyClient.java


示例11: clearScroll

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
/**
 * Clears the given scroll Ids
 */
public void clearScroll(final String... scrollIds) {
    final ClearScrollResponse clearResponse = client().prepareClearScroll().setScrollIds(Arrays.asList(scrollIds)).get();
    assertThat(clearResponse.isSucceeded(), equalTo(true));
}
 
开发者ID:salyh,项目名称:elasticsearch-sample-plugin-audit,代码行数:8,代码来源:ElasticsearchIntegrationTest.java


示例12: clearScroll

import org.elasticsearch.action.search.ClearScrollResponse; //导入依赖的package包/类
/**
 * Clears the search contexts associated with specified scroll ids.
 */
ActionFuture<ClearScrollResponse> clearScroll(ClearScrollRequest request);
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:Client.java



注:本文中的org.elasticsearch.action.search.ClearScrollResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MonetaryConversions类代码示例发布时间:2022-05-22
下一篇:
Java S0DPacketCollectItem类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap