Skip to content

Commit 9ea2901

Browse files
authored
Add examples to search and open PIT APIs (#3561)
1 parent fa5e9a8 commit 9ea2901

File tree

13 files changed

+635
-308
lines changed

13 files changed

+635
-308
lines changed

output/openapi/elasticsearch-openapi.json

Lines changed: 87 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/openapi/elasticsearch-serverless-openapi.json

Lines changed: 87 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

Lines changed: 121 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_doc_ids/table.csv

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ ccr-put-auto-follow-pattern,https://www.elastic.co/guide/en/elasticsearch/refere
6666
ccr-put-follow,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-put-follow.html
6767
ccr-resume-auto-follow-pattern,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ccr-resume-auto-follow-pattern.html
6868
ccs-network-delays,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/modules-cross-cluster-search.html#ccs-network-delays
69+
ccs-privileges,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/remote-clusters-cert.html#remote-clusters-privileges-ccs
6970
clean-up-snapshot-repo,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/snapshots-register-repository.html#snapshots-repository-cleanup
7071
clear-repositories-metering-archive-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/clear-repositories-metering-archive-api.html
7172
clear-scroll-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/clear-scroll-api.html
@@ -151,6 +152,7 @@ docs-termvectors,https://www.elastic.co/guide/en/elasticsearch/reference/{branch
151152
docs-update-by-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/docs-update-by-query.html
152153
docs-update,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/docs-update.html
153154
document-input-parameters,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-mlt-query.html#_document_input_parameters
155+
docvalue-fields,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-fields.html#docvalue-fields
154156
dot-expand-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/dot-expand-processor.html
155157
drop-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/drop-processor.html
156158
enrich-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/enrich-processor.html
@@ -286,6 +288,7 @@ json-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/
286288
k-precision,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-rank-eval.html#k-precision
287289
k-recall,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-rank-eval.html#k-recall
288290
kv-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/kv-processor.html
291+
knn-approximate,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/knn-search.html#approximate-knn
289292
knn-inner-hits,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/knn-search.html#nested-knn-search-inner-hits
290293
license-management,https://www.elastic.co/guide/en/kibana/{branch}/managing-licenses.html
291294
logstash-api-delete-pipeline,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/logstash-api-delete-pipeline.html
@@ -450,6 +453,7 @@ query-dsl-span-not-query,https://www.elastic.co/guide/en/elasticsearch/reference
450453
query-dsl-span-or-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-or-query.html
451454
query-dsl-span-term-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-term-query.html
452455
query-dsl-span-within-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-within-query.html
456+
query-dsl-sparse-vector-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-sparse-vector-query.html
453457
query-dsl-term-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-term-query.html
454458
query-dsl-terms-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-terms-query.html
455459
query-dsl-terms-set-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-terms-set-query.html
@@ -472,6 +476,7 @@ redact-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch
472476
regexp-syntax,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/regexp-syntax.html
473477
register-repository,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/snapshots-register-repository.html
474478
registered-domain-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/registered-domain-processor.html
479+
relevance-scores,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-filter-context.html#relevance-scores
475480
remove-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/remove-processor.html
476481
remote-clusters-api-key,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/remote-clusters-api-key.html
477482
rename-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/rename-processor.html
@@ -686,6 +691,7 @@ security-user-cache,https://www.elastic.co/guide/en/elasticsearch/reference/{bra
686691
service-accounts,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/service-accounts.html
687692
set-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/set-processor.html
688693
shape,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/shape.html
694+
shard-request-cache,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/shard-request-cache.html
689695
simulate-ingest-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/simulate-ingest-api.html
690696
simulate-pipeline-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/simulate-pipeline-api.html
691697
slice-scroll,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/paginate-search-results.html#slice-scroll
@@ -716,7 +722,7 @@ snapshot-restore-feature-state,https://www.elastic.co/guide/en/elasticsearch/ref
716722
sort-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sort-processor.html
717723
sort-search-results,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sort-search-results.html
718724
sort-tiebreaker,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/eql.html#eql-search-specify-a-sort-tiebreaker
719-
query-dsl-sparse-vector-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-sparse-vector-query.html
725+
source-filtering,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-fields.html#source-filtering
720726
split-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/split-processor.html
721727
sql-async-search-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-async-sql-search-api.html
722728
sql-async-status-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-async-sql-search-status-api.html
@@ -736,6 +742,7 @@ start-trial,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sta
736742
stop-dfanalytics,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/stop-dfanalytics.html
737743
stop-trained-model-deployment,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/stop-trained-model-deployment.html
738744
stop-transform,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/stop-transform.html
745+
stored-fields,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-fields.html#stored-fields
739746
synonym-rule-create,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/put-synonym-rule.html
740747
synonym-rule-delete,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-synonym-rule.html
741748
synonym-rule-get,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-synonym-rule.html

specification/_global/open_point_in_time/OpenPointInTimeRequest.ts

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,40 @@ import { Duration } from '@_types/Time'
3333
* between searches are only visible to the more recent point in time.
3434
*
3535
* A point in time must be opened explicitly before being used in search requests.
36-
* The `keep_alive` parameter tells Elasticsearch how long it should persist.
36+
*
37+
* A subsequent search request with the `pit` parameter must not specify `index`, `routing`, or `preference` values as these parameters are copied from the point in time.
38+
*
39+
* Just like regular searches, you can use `from` and `size` to page through point in time search results, up to the first 10,000 hits.
40+
* If you want to retrieve more hits, use PIT with `search_after`.
41+
*
42+
* IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request.
43+
*
44+
* When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a `NoShardAvailableActionException` exception.
45+
* To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime.
46+
*
47+
* **Keeping point in time alive**
48+
*
49+
* The `keep_alive` parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time.
50+
* The value does not need to be long enough to process all data — it just needs to be long enough for the next request.
51+
*
52+
* Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments.
53+
* Once the smaller segments are no longer needed they are deleted.
54+
* However, open point-in-times prevent the old segments from being deleted since they are still in use.
55+
*
56+
* TIP: Keeping older segments alive means that more disk space and file handles are needed.
57+
* Ensure that you have configured your nodes to have ample free file handles.
58+
*
59+
* Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request.
60+
* Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates.
61+
* Note that a point-in-time doesn't prevent its associated indices from being deleted.
62+
* You can check how many point-in-times (that is, search contexts) are open with the nodes stats API.
3763
* @rest_spec_name open_point_in_time
3864
* @availability stack since=7.10.0 stability=stable
3965
* @availability serverless stability=stable visibility=public
4066
* @doc_id point-in-time-api
4167
* @index_privileges read
4268
* @doc_tag search
69+
* @doc_id point-in-time-api
4370
*/
4471
export interface Request extends RequestBase {
4572
urls: [
@@ -53,7 +80,7 @@ export interface Request extends RequestBase {
5380
}
5481
query_parameters: {
5582
/**
56-
* Extends the time to live of the corresponding point in time.
83+
* Extend the length of time that the point in time persists.
5784
*/
5885
keep_alive: Duration
5986
/**
@@ -62,22 +89,23 @@ export interface Request extends RequestBase {
6289
*/
6390
ignore_unavailable?: boolean
6491
/**
65-
* Specifies the node or shard the operation should be performed on.
66-
* Random by default.
92+
* The node or shard the operation should be performed on.
93+
* By default, it is random.
6794
*/
6895
preference?: string
6996
/**
70-
* Custom value used to route operations to a specific shard.
97+
* A custom value that is used to route operations to a specific shard.
7198
*/
7299
routing?: Routing
73100
/**
74-
* Type of index that wildcard patterns can match.
101+
* The type of index that wildcard patterns can match.
75102
* If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.
76-
* Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`.
103+
* It supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`.
77104
* @server_default open
78105
*/
79106
expand_wildcards?: ExpandWildcards
80107
/**
108+
* Indicates whether the point in time tolerates unavailable shards or shard failures when initially creating the PIT.
81109
* If `false`, creating a point in time request when a shard is missing or unavailable will throw an exception.
82110
* If `true`, the point in time will contain all the shards that are available at the time of the request.
83111
* @server_default false
@@ -86,7 +114,7 @@ export interface Request extends RequestBase {
86114
}
87115
body: {
88116
/**
89-
* Allows to filter indices if the provided query rewrites to `match_none` on every shard.
117+
* Filter indices if the provided query rewrites to `match_none` on every shard.
90118
*/
91119
index_filter?: QueryContainer
92120
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# summary:
2+
description: >
3+
A successful response from `POST /my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true`.
4+
It includes a summary of the total number of shards, as well as the number of successful shards when creating the PIT.
5+
# type: response
6+
# response_code: ''
7+
value: |-
8+
{
9+
"id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=",
10+
"_shards": {
11+
"total": 10,
12+
"successful": 10,
13+
"skipped": 0,
14+
"failed": 0
15+
}
16+
}

0 commit comments

Comments
 (0)