searchSourceBuilder.from(start); searchSourceBuilder.size(size);
searchSourceBuilder.from(offset);
searchSourceBuilder.from(start); searchSourceBuilder.size(size);
searchSourceBuilder.from((int) offset); searchSourceBuilder.size(pageable.getPageSize());
/** * From index to start the search from. Defaults to {@code 0}. */ public SearchRequestBuilder setFrom(int from) { sourceBuilder().from(from); return this; }
sourceBuilder.size(query.getPageable().getPageSize()); sourceBuilder.from(startRecord);
SearchSourceBuilder builder = new SearchSourceBuilder(); builder.query(QueryBuilders.multiMatchQuery(keyword, fields)); builder.from((pageNo - 1) * pageSize).size(pageSize); request.source(builder); SearchResponse response = client.search(request, RequestOptions.DEFAULT);
@Override public ActionRequestValidationException validate() { ActionRequestValidationException validationException = null; final Scroll scroll = scroll(); if (source != null && source.trackTotalHits() == false && scroll != null) { validationException = addValidationError("disabling [track_total_hits] is not allowed in a scroll context", validationException); } if (source != null && source.from() > 0 && scroll != null) { validationException = addValidationError("using [from] is not allowed in a scroll context", validationException); } if (requestCache != null && requestCache && scroll != null) { DEPRECATION_LOGGER.deprecated("Explicitly set [request_cache] for a scroll query is deprecated and will return a 400 " + "error in future versions"); } if (source != null && source.size() == 0 && scroll != null) { validationException = addValidationError("[size] cannot be [0] in a scroll context", validationException); } if (source != null && source.rescores() != null && source.rescores().isEmpty() == false && scroll != null) { DEPRECATION_LOGGER.deprecated("Using [rescore] for a scroll query is deprecated and will be ignored. From 7.0 on will " + "return a 400 error"); } return validationException; }
for (int i = 1; i < pages; i++) { int from = i * pageSize; builder.from(from); esResponse = transportClient.search(request); allResults.addAll(getSearchResults(esResponse));
@Override public ActionRequestValidationException validate() { ActionRequestValidationException e = searchRequest.validate(); if (searchRequest.source().from() != -1) { e = addValidationError("from is not supported in this context", e); } if (searchRequest.source().storedFields() != null) { e = addValidationError("stored_fields is not supported in this context", e); } if (maxRetries < 0) { e = addValidationError("retries cannot be negative", e); } if (false == (size == -1 || size > 0)) { e = addValidationError( "size should be greater than 0 if the request is limited to some number of documents or -1 if it isn't but it was [" + size + "]", e); } if (searchRequest.source().slice() != null && slices != DEFAULT_SLICES) { e = addValidationError("can't specify both manual and automatic slicing at the same time", e); } return e; }
.from(searchRequest.getFrom()) .query(queryBuilder) .trackScores(true);
/** * From index to start the search from. Defaults to {@code 0}. */ public SearchRequestBuilder setFrom(int from) { sourceBuilder().from(from); return this; }
/** * From index to start the search from. Defaults to {@code 0}. */ public SearchRequestBuilder setFrom(int from) { sourceBuilder().from(from); return this; }
/** * From index to start the search from. Defaults to <tt>0</tt>. */ public SearchRequestBuilder setFrom(int from) { sourceBuilder().from(from); return this; }
/** * The index to start to return hits from. Defaults to <tt>0</tt>. */ public TopHitsBuilder setFrom(int from) { sourceBuilder().from(from); return this; }
searchSourceBuilder.from(from);
private SearchSourceBuilder buildExpandSearchSourceBuilder(InnerHitBuilder options, CollapseBuilder innerCollapseBuilder) { SearchSourceBuilder groupSource = new SearchSourceBuilder(); groupSource.from(options.getFrom()); groupSource.size(options.getSize()); if (options.getSorts() != null) {
context.from(source.from()); context.size(source.size()); Map<String, InnerHitContextBuilder> innerHitBuilders = new HashMap<>();
@Override public List<?> nativeQuery(String query, Map<String, Object> params, int pageNb, int pageSize) { SearchRequest request = buildQuery(query, params); if (pageNb > 0) { request.source().from(pageNb * pageSize); } if (pageSize > 0) { request.source().size(pageSize); } SearchResponse searchResponse = runRequest(request); return buildLogEntries(searchResponse); }
@Bean public SearchSourceBuilder getSearchSourceBuilder(){ SearchSourceBuilder sourceBuilder = new SearchSourceBuilder(); sourceBuilder.from(props.getIndex().getFrom()); sourceBuilder.size(props.getIndex().getSize()); sourceBuilder.timeout(new TimeValue(props.getIndex().getTimeout(), TimeUnit.SECONDS)); return sourceBuilder; }