Open a point in timeedit

A point in time must be opened before being used in search requests. An OpenPointInTimeRequest requires an index and keepAlive arguments:

OpenPointInTimeRequest openRequest = new OpenPointInTimeRequest("posts"); 
OpenPointInTimeResponse openResponse = client.openPointInTime(openRequest, RequestOptions.DEFAULT);
String pitId = openResponse.getPointInTimeId(); 

Create an OpenPointInTimeRequest with the target indices

Set the keep_alive - a required parameter, which tells Elasticsearch how long it should keep a point in time around.

Read the returned point in time id, which points to the search context that’s being kept alive and will be used in the search requests.

Optional argumentsedit

The following arguments can optionally be provided:


Setting IndicesOptions controls how unavailable indices are resolved and how wildcard expressions are expanded


Set a routing parameter


Use the preference parameter e.g. to execute the search to prefer local shards. The default is to randomize across shards.