org.elasticsearch.client.RestHighLevelClient.searchScroll()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中org.elasticsearch.client.RestHighLevelClient.searchScroll方法的一些代码示例,展示了RestHighLevelClient.searchScroll的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RestHighLevelClient.searchScroll方法的具体详情如下:
包路径:org.elasticsearch.client.RestHighLevelClient
类名称:RestHighLevelClient
方法名:searchScroll

RestHighLevelClient.searchScroll介绍

[英]Executes a search using the Search Scroll API. See Search Scroll API on elastic.co
[中]使用搜索滚动API执行搜索。见Search Scroll API on elastic.co

代码示例

代码示例来源:origin: spring-projects/spring-data-elasticsearch

public <T> Page<T> continueScroll(@Nullable String scrollId, long scrollTimeInMillis, Class<T> clazz) {
  SearchScrollRequest request = new SearchScrollRequest(scrollId);
  request.scroll(TimeValue.timeValueMillis(scrollTimeInMillis));
  SearchResponse response;
  try {
    response = client.searchScroll(request);
  } catch (IOException e) {
    throw new ElasticsearchException("Error for search request with scroll: " + request.toString(), e);
  }
  return resultsMapper.mapResults(response, clazz, Pageable.unpaged());
}

代码示例来源:origin: spring-projects/spring-data-elasticsearch

public <T> Page<T> continueScroll(@Nullable String scrollId, long scrollTimeInMillis, Class<T> clazz,
    SearchResultMapper mapper) {
  SearchScrollRequest request = new SearchScrollRequest(scrollId);
  request.scroll(TimeValue.timeValueMillis(scrollTimeInMillis));
  SearchResponse response;
  try {
    response = client.searchScroll(request);
  } catch (IOException e) {
    throw new ElasticsearchException("Error for search request with scroll: " + request.toString(), e);
  }
  return mapper.mapResults(response, clazz, Pageable.unpaged());
}

代码示例来源:origin: streampipes/streampipes-ce

SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId);
scrollRequest.scroll(TimeValue.timeValueSeconds(30));
SearchResponse searchScrollResponse = client.searchScroll(scrollRequest);
scrollId = searchScrollResponse.getScrollId();
hits = searchScrollResponse.getHits();

代码示例来源:origin: eea/eea.elasticsearch.river.rdf

SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId);
scrollRequest.scroll(scroll);
searchResponse = client.searchScroll(scrollRequest);
scrollId = searchResponse.getScrollId();
searchHits = searchResponse.getHits().getHits();

代码示例来源:origin: mnemonic-no/act-platform

private ScrollingSearchResult.ScrollingBatch<FactDocument> fetchNextFactsBatch(String scrollId) {
 SearchResponse response;
 try {
  response = clientFactory.getHighLevelClient().searchScroll(new SearchScrollRequest()
      .scrollId(scrollId)
      .scroll(searchScrollExpiration));
 } catch (IOException ex) {
  LOGGER.warning(ex, "Could not perform request to retrieve next batch of search results. Stop scrolling.");
  return ScrollingSearchResult.emptyBatch();
 }
 if (response.status() != RestStatus.OK) {
  LOGGER.warning("Could not retrieve next batch of search results (response code %s). Stop scrolling.", response.status());
  return ScrollingSearchResult.emptyBatch();
 }
 return createFactsBatch(response);
}

代码示例来源:origin: eea/eea.elasticsearch.river.rdf

SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId);
scrollRequest.scroll(scroll);
searchResponse = client.searchScroll(scrollRequest);
scrollId = searchResponse.getScrollId();
searchHits = searchResponse.getHits().getHits();

相关文章

微信公众号

最新文章

更多