org.elasticsearch.action.search.ClearScrollResponse Java Examples

The following examples show how to use org.elasticsearch.action.search.ClearScrollResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestClearScrollAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@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));
}
 
Example #2
Source File: ReindexingService.java    From elasticsearch-reindexing with Apache License 2.0 6 votes vote down vote up
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);
                        }
                    }
                });
    }
}
 
Example #3
Source File: SearchQueryServiceImpl.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private void closeScrollId() {
  log.debug("Clearing scroll id {}", response.getScrollId());
  ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
  clearScrollRequest.addScrollId(response.getScrollId());
  ClearScrollResponse clearScrollResponse = client.get().clearScroll(clearScrollRequest).actionGet();
  if (!clearScrollResponse.isSucceeded()) {
    log.info("Unable to close scroll id {}", response.getScrollId());
  }
}
 
Example #4
Source File: ElasticsearchSearchQueryBase.java    From vertexium with Apache License 2.0 5 votes vote down vote up
private void closeScroll(String scrollId) {
    try {
        ClearScrollResponse clearScrollResponse = client.prepareClearScroll()
            .addScrollId(scrollId)
            .execute().actionGet();
        if (!clearScrollResponse.isSucceeded()) {
            LOGGER.warn("Unable to clear scroll " + scrollId);
        }
    } catch (Exception ex) {
        throw new VertexiumException("Could not close iterator " + scrollId, ex);
    }
}
 
Example #5
Source File: ElasticsearchSearchQueryBase.java    From vertexium with Apache License 2.0 5 votes vote down vote up
private void closeScroll(String scrollId) {
    try {
        ClearScrollResponse clearScrollResponse = client.prepareClearScroll()
            .addScrollId(scrollId)
            .execute().actionGet();
        if (!clearScrollResponse.isSucceeded()) {
            LOGGER.warn("Unable to clear scroll " + scrollId);
        }
    } catch (Exception ex) {
        throw new VertexiumException("Could not close iterator " + scrollId, ex);
    }
}
 
Example #6
Source File: TransportConnection.java    From heroic with Apache License 2.0 5 votes vote down vote up
@Override
@NotNull
public ActionFuture<ClearScrollResponse> clearSearchScroll(@NotNull String scrollId) {
    ClearScrollRequest request = new ClearScrollRequest();
    request.addScrollId(scrollId);
    return client.clearScroll(request);
}
 
Example #7
Source File: ClientWithStats.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public ActionFuture<ClearScrollResponse> clearScroll(ClearScrollRequest request) {
	return wrapped.clearScroll(request);
}
 
Example #8
Source File: ClientWithStats.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void clearScroll(ClearScrollRequest request, ActionListener<ClearScrollResponse> listener) {
	wrapped.clearScroll(request, listener);
}
 
Example #9
Source File: ReactorElasticSearchClient.java    From james-project with Apache License 2.0 4 votes vote down vote up
public Mono<ClearScrollResponse> clearScroll(ClearScrollRequest clearScrollRequest, RequestOptions options) {
    return toReactor(listener -> client.clearScrollAsync(clearScrollRequest, options, listener));
}
 
Example #10
Source File: FessEsClient.java    From fess with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<ClearScrollResponse> clearScroll(final ClearScrollRequest request) {
    return client.clearScroll(request);
}
 
Example #11
Source File: FessEsClient.java    From fess with Apache License 2.0 4 votes vote down vote up
@Override
public void clearScroll(final ClearScrollRequest request, final ActionListener<ClearScrollResponse> listener) {
    client.clearScroll(request, listener);
}