mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
parent
ce41fd7e2a
commit
44fc661835
21 changed files with 489 additions and 98 deletions
78
docs/java-rest/high-level/search/point-in-time.asciidoc
Normal file
78
docs/java-rest/high-level/search/point-in-time.asciidoc
Normal file
|
@ -0,0 +1,78 @@
|
|||
[[java-rest-high-search-point-in-time]]
|
||||
|
||||
=== Open a point in time
|
||||
|
||||
A point in time must be opened before being used in search requests.
|
||||
An OpenPointInTimeRequest requires an `index` and `keepAlive` arguments:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/SearchDocumentationIT.java[open-point-in-time]
|
||||
--------------------------------------------------
|
||||
<1> Create an `OpenPointInTimeRequest` with the target indices
|
||||
<2> Set the `keep_alive` - a required parameter, which tells
|
||||
Elasticsearch how long it should keep a point in time around.
|
||||
<3> 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 arguments
|
||||
The following arguments can optionally be provided:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/SearchDocumentationIT.java[open-point-in-time-indices-option]
|
||||
--------------------------------------------------
|
||||
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
|
||||
how wildcard expressions are expanded
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/SearchDocumentationIT.java[open-point-in-time-routing]
|
||||
--------------------------------------------------
|
||||
<1> Set a routing parameter
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/SearchDocumentationIT.java[open-point-in-time-preference]
|
||||
--------------------------------------------------
|
||||
<1> Use the preference parameter e.g. to execute the search to prefer local
|
||||
shards. The default is to randomize across shards.
|
||||
|
||||
=== Search with point in time
|
||||
A 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.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/SearchDocumentationIT.java[search-point-in-time]
|
||||
--------------------------------------------------
|
||||
<1> Create a PointInTimeBuilder with a PIT id
|
||||
<2> (Optional) Set the keep alive of a point in time
|
||||
<3> 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`.
|
||||
|
||||
==== Paginate search results with point in time
|
||||
A point in time can be used in search after requests to paginate search results.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/SearchDocumentationIT.java[search-after-with-point-in-time]
|
||||
--------------------------------------------------
|
||||
<1> Open a point in time that will be used in multiple search_after requests
|
||||
<2> Create a search request with the sort parameter
|
||||
<3> Set the search_after parameter using the sort values from the previous page
|
||||
<4> Pass a point in time to a search request
|
||||
<5> Close the point in time
|
||||
|
||||
=== Close point in time
|
||||
|
||||
Point in time should be closed as soon as they are no longer used in search requests.
|
||||
A ClosePointInTime request requires a point in time id argument:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/SearchDocumentationIT.java[close-point-in-time]
|
||||
--------------------------------------------------
|
||||
<1> Create a close point in time request with a PIT id
|
Loading…
Add table
Add a link
Reference in a new issue