本文整理汇总了Java中org.elasticsearch.action.search.SearchScrollRequestBuilder类的典型用法代码示例。如果您正苦于以下问题:Java SearchScrollRequestBuilder类的具体用法?Java SearchScrollRequestBuilder怎么用?Java SearchScrollRequestBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SearchScrollRequestBuilder类属于org.elasticsearch.action.search包,在下文中一共展示了SearchScrollRequestBuilder类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: scroll
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
protected Observable<SearchResponse> scroll() {
return defer(() -> {
if (scrollId == null) {
return just(null);
}
SearchScrollRequestBuilder request = elasticsearch.get()
.prepareSearchScroll(scrollId)
.setScroll(timeValueMillis(elasticsearch.getDefaultScrollTimeout()));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Request = " + Jsonify.toString(request));
}
return elasticsearch.execute(vertxContext, request, elasticsearch.getDefaultSearchTimeout())
.map(Optional::get)
.flatMap(searchResponse -> just(searchResponse)
.map(searchResponse1 -> {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Response = " + Jsonify.toString(searchResponse1));
}
return searchResponse1;
}));
});
}
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:26,代码来源:ScanAndScrollStreamProducer.java
示例2: scrollNext
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
protected <E extends EsDocument> ScrollableResponse<List<E>> scrollNext(
String scrollId, ThrowingFunction<String, E> createFunc)
throws Exception {
SearchScrollRequestBuilder
builder =
esClient.prepareSearchScroll(scrollId)
.setScroll(TimeValue.timeValueMillis(SCROLLDEFAULTTIMEOUT));
SearchResponse response = builder.execute().actionGet();
ArrayList<E> list = new ArrayList<>();
ScrollableResponse<List<E>> ret = new ScrollableResponse<>();
ret.setValue(list);
ret.setContinousToken(response.getScrollId());
if (response.getHits().totalHits() == 0) {
//Clear the scroll as early as possible to save resource
ClearScrollRequestBuilder
clearRequestBuilder =
esClient.prepareClearScroll().addScrollId(scrollId);
clearRequestBuilder.execute();
ret.setScrollToEnd(true);
} else {
for (int i = 0; i < response.getHits().getHits().length; i++) {
String str = response.getHits().getAt(i).getSourceAsString();
E element = createFunc.apply(str);
element.setId(response.getHits().getAt(i).getId());
list.add(element);
}
}
return ret;
}
开发者ID:pinterest,项目名称:soundwave,代码行数:30,代码来源:EsStore.java
示例3: emit
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
public void emit() {
// 构建查询
Scroll esScroll = new Scroll(new TimeValue(scroll, TimeUnit.MINUTES));
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(index).setScroll(esScroll).setQuery(query).setSize(size);
if (StringUtils.isNotEmpty(type)) {
searchRequestBuilder.setTypes(type);
}
if (logger.isDebugEnabled()) {
logger.debug(searchRequestBuilder.toString());
}
String scrollId = null;
try {
SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();
scrollId = searchResponse.getScrollId();
long total = searchResponse.getHits().getTotalHits();
// 处理第一次search查询
int messageCount = submitMessage(searchResponse);
// 计算剩余的批次
long remainTotal = total - messageCount;
long batchNum = remainTotal % size == 0 ? remainTotal / size : (remainTotal / size) + 1;
for (long i = 0; !stop && i < batchNum; i++) {
// 按批查询数据
SearchScrollRequestBuilder scrollRequestBuilder = client.prepareSearchScroll(scrollId).setScroll(esScroll);
searchResponse = scrollRequestBuilder.execute().actionGet();
submitMessage(searchResponse);
}
} catch (Exception e) {
logger.error("query error", e);
} finally {
if (StringUtils.isNotEmpty(scrollId)) {
client.prepareClearScroll().addScrollId(scrollId).execute().actionGet();
}
}
}
开发者ID:DTStack,项目名称:jlogstash-input-plugin,代码行数:40,代码来源:Elasticsearch.java
示例4: prepareSearchScroll
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
public SearchScrollRequestBuilder prepareSearchScroll(String scrollId) {
return client.prepareSearchScroll(scrollId);
}
开发者ID:Lambda-3,项目名称:Stargraph,代码行数:4,代码来源:ElasticClient.java
示例5: prepareSearchScroll
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
@Override
public SearchScrollRequestBuilder prepareSearchScroll(String scrollId) {
return new SearchScrollRequestBuilder(this, SearchScrollAction.INSTANCE, scrollId);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java
示例6: scroll
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
protected Observable<Void> scroll(
final PersistentAccount account,
final String prefix,
final String delimiter,
final String marker,
final String endMarker,
final int limit,
final Elasticsearch elasticsearch,
final String scrollId,
final NavigableMap<String, SparseContainer> listedContainers) {
SearchScrollRequestBuilder scrollRequest =
elasticsearch.get().prepareSearchScroll(scrollId)
.setScroll(timeValueMillis(elasticsearch.getDefaultScrollTimeout()));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(format("Search Request = %s", Jsonify.toString(scrollRequest)));
}
return elasticsearch.execute(vertxContext, scrollRequest, elasticsearch.getDefaultSearchTimeout())
.map(Optional::get)
.flatMap(searchResponse -> {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(format("Search Response = %s", Jsonify.toString(searchResponse)));
}
SearchHits hits = searchResponse.getHits();
int numberOfHits = hits.getHits().length;
if (numberOfHits > 0) {
return toIterable(account, prefix, delimiter, marker, endMarker, hits)
.doOnNext(sparseContainer -> {
String id = sparseContainer.getContainerName();
SparseContainer existing = listedContainers.get(id);
if (existing == null) {
listedContainers.put(id, sparseContainer);
} else {
existing.setByteCount(existing.getByteCount() + sparseContainer.getByteCount());
existing.setObjectCount(existing.getObjectCount() + sparseContainer.getObjectCount());
}
if (listedContainers.size() > limit) {
listedContainers.pollLastEntry();
}
})
.count()
.map(new ToVoid<>())
.flatMap(aVoid -> scroll(account, prefix, delimiter, marker, endMarker, limit, elasticsearch, searchResponse.getScrollId(), listedContainers));
} else {
return clearScroll(elasticsearch, searchResponse.getScrollId());
}
});
}
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:51,代码来源:ListContainers.java
示例7: scroll
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
protected Observable<Void> scroll(
final PersistentContainer container,
final String prefix,
final String delimiter,
final String marker,
final String endMarker,
final int limit,
final Elasticsearch elasticsearch,
final String scrollId,
final NavigableMap<String, ListedObject> listedObjects) {
SearchScrollRequestBuilder scrollRequest =
elasticsearch.get().prepareSearchScroll(scrollId)
.setScroll(timeValueMillis(elasticsearch.getDefaultScrollTimeout()));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(format("Search Request = %s", Jsonify.toString(scrollRequest)));
}
return elasticsearch.execute(vertxContext, scrollRequest, elasticsearch.getDefaultSearchTimeout())
.map(Optional::get)
.flatMap(searchResponse -> {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(format("Search Response = %s", Jsonify.toString(searchResponse)));
}
SearchHits hits = searchResponse.getHits();
int numberOfHits = hits.getHits().length;
if (numberOfHits > 0) {
for (ListedObject listedObject : toIterable(container, prefix, delimiter, marker, endMarker, hits)) {
String id = listedObject.getName();
ListedObject existing = listedObjects.get(id);
if (existing == null) {
listedObjects.put(id, listedObject);
} else {
existing.setLength(existing.getLength() + listedObject.getLength());
}
if (listedObjects.size() > limit) {
listedObjects.pollLastEntry();
}
}
return scroll(container, prefix, delimiter, marker, endMarker, limit, elasticsearch, searchResponse.getScrollId(), listedObjects);
} else {
return clearScroll(elasticsearch, searchResponse.getScrollId());
}
});
}
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:47,代码来源:ListObjects.java
示例8: prepareSearchScroll
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
@Override
public SearchScrollRequestBuilder prepareSearchScroll(String scrollId) {
// TODO Auto-generated method stub
return null;
}
开发者ID:winterstein,项目名称:elasticsearch-java-client,代码行数:6,代码来源:DummyClient.java
示例9: prepareSearchScroll
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
public SearchScrollRequestBuilder prepareSearchScroll(String scrollId) {
return client.getClient().prepareSearchScroll(scrollId);
}
开发者ID:spotify,项目名称:heroic,代码行数:4,代码来源:Connection.java
示例10: prepareSearchScroll
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
public SearchScrollRequestBuilder prepareSearchScroll(String scrollId) {
return internalClient.prepareSearchScroll(scrollId);
}
开发者ID:spacedog-io,项目名称:spacedog-server,代码行数:4,代码来源:ElasticClient.java
示例11: getScrollBuilder
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
public SearchScrollRequestBuilder getScrollBuilder(String scrollId){
return esProvider.getClient().prepareSearchScroll( scrollId );
}
开发者ID:apache,项目名称:usergrid,代码行数:4,代码来源:SearchRequestBuilderStrategyV2.java
示例12: prepareSearchScroll
import org.elasticsearch.action.search.SearchScrollRequestBuilder; //导入依赖的package包/类
/**
* A search scroll request to continue searching a previous scrollable search request.
*/
SearchScrollRequestBuilder prepareSearchScroll(String scrollId);
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:Client.java
注:本文中的org.elasticsearch.action.search.SearchScrollRequestBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论