[[reference-open_point_in_time]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////

[discrete]
[[client.openPointInTime]]
=== client.openPointInTime

Open a point in time. A search request by default runs against the most recent visible data of the target indices, which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple search requests using the same point in time. For example, if refreshes happen between `search_after` requests, then the results of those requests might not be consistent as changes happening between searches are only visible to the more recent point in time. A point in time must be opened explicitly before being used in search requests. The `keep_alive` parameter tells Elasticsearch how long it should persist.

{ref}/point-in-time-api.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(OpenPointInTimeRequest, options?): Promise<OpenPointInTimeResponse>
----

[discrete]
==== Request

[pass]
++++
<pre>
++++
interface OpenPointInTimeRequest extends <<RequestBase>> {
  index: <<Indices>>
  keep_alive: <<Duration>>
  ignore_unavailable?: boolean
  preference?: string
  routing?: <<Routing>>
  expand_wildcards?: <<ExpandWildcards>>
  index_filter?: <<QueryDslQueryContainer>>
}

[pass]
++++
</pre>
++++
[discrete]
==== Response

[pass]
++++
<pre>
++++
interface OpenPointInTimeResponse {
  _shards: <<ShardStatistics>>
  id: <<Id>>
}

[pass]
++++
</pre>
++++
