WARNING: Deprecated in 7.15.0.
The Java REST Client is deprecated in favor of the Java API Client.
Search with point in time
editSearch with point in time
editA point in time can be passed to a search request via a PointInTimeBuilder, which requires a point in time ID returned from the open API.
SearchRequest searchRequest = new SearchRequest(); final PointInTimeBuilder pointInTimeBuilder = new PointInTimeBuilder(pitId); pointInTimeBuilder.setKeepAlive("2m"); searchRequest.source(new SearchSourceBuilder().pointInTimeBuilder(pointInTimeBuilder)); SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);
Create a PointInTimeBuilder with a PIT id |
|
(Optional) Set the keep alive of a point in time |
|
Pass a point in time to a search request |
A search request with a point in time does not accept these parameters:
indices
, indicesOptions
routing
, preference
, and ccsMinimizeRoundtrips
.
A point in time can be used in search after requests to paginate search results.