Skip to content

Commit 00fbe2f

Browse files
[DOCS] Adds description to global APIs part 3 (#2271)
Co-authored-by: Abdon Pijpelink <[email protected]>
1 parent 7d1e6fb commit 00fbe2f

File tree

13 files changed

+515
-109
lines changed

13 files changed

+515
-109
lines changed

output/schema/schema.json

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

specification/_global/exists/DocumentExistsRequest.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,71 @@ import {
2929
import { SourceConfigParam } from '@global/search/_types/SourceFilter'
3030

3131
/**
32+
* Checks if a document in an index exists.
3233
* @rest_spec_name exists
3334
* @availability stack since=0.0.0 stability=stable
3435
* @availability serverless stability=stable visibility=public
3536
*/
3637
export interface Request extends RequestBase {
3738
path_parts: {
39+
/**
40+
* Identifier of the document.
41+
*/
3842
id: Id
43+
/**
44+
* Comma-separated list of data streams, indices, and aliases.
45+
* Supports wildcards (`*`).
46+
*/
3947
index: IndexName
4048
}
4149
query_parameters: {
50+
/**
51+
* Specifies the node or shard the operation should be performed on.
52+
* Random by default.
53+
*/
4254
preference?: string
55+
/**
56+
* If `true`, the request is real-time as opposed to near-real-time.
57+
* @server_default true
58+
* @doc_id realtime
59+
*/
4360
realtime?: boolean
61+
/**
62+
* If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes.
63+
* @server_default false
64+
*/
4465
refresh?: boolean
66+
/**
67+
* Target the specified primary shard.
68+
* @doc_id routing
69+
*/
4570
routing?: Routing
71+
/**
72+
* `true` or `false` to return the `_source` field or not, or a list of fields to return.
73+
*/
4674
_source?: SourceConfigParam
75+
/**
76+
* A comma-separated list of source fields to exclude in the response.
77+
*/
4778
_source_excludes?: Fields
79+
/**
80+
* A comma-separated list of source fields to include in the response.
81+
*/
4882
_source_includes?: Fields
83+
/**
84+
* List of stored fields to return as part of a hit.
85+
* If no fields are specified, no stored fields are included in the response.
86+
* If this field is specified, the `_source` parameter defaults to false.
87+
*/
4988
stored_fields?: Fields
89+
/**
90+
* Explicit version number for concurrency control.
91+
* The specified version must match the current version of the document for the request to succeed.
92+
*/
5093
version?: VersionNumber
94+
/**
95+
* Specific version type: `external`, `external_gte`.
96+
*/
5197
version_type?: VersionType
5298
}
5399
}

specification/_global/exists_source/SourceExistsRequest.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,65 @@ import {
2929
import { SourceConfigParam } from '@global/search/_types/SourceFilter'
3030

3131
/**
32+
* Checks if a document's `_source` is stored.
3233
* @rest_spec_name exists_source
3334
* @availability stack since=5.4.0 stability=stable
3435
* @availability serverless stability=stable visibility=public
3536
*/
3637
export interface Request extends RequestBase {
3738
path_parts: {
39+
/**
40+
* Identifier of the document.
41+
*/
3842
id: Id
43+
/**
44+
* Comma-separated list of data streams, indices, and aliases.
45+
* Supports wildcards (`*`).
46+
*/
3947
index: IndexName
4048
}
4149
query_parameters: {
50+
/**
51+
* Specifies the node or shard the operation should be performed on.
52+
* Random by default.
53+
*/
4254
preference?: string
55+
/**
56+
* If true, the request is real-time as opposed to near-real-time.
57+
* @server_default true
58+
* @doc_id realtime
59+
*/
4360
realtime?: boolean
61+
/**
62+
* If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes.
63+
* @server_default false
64+
*/
4465
refresh?: boolean
66+
/**
67+
* Target the specified primary shard.
68+
* @doc_id routing
69+
*/
4570
routing?: Routing
71+
/**
72+
* `true` or `false` to return the `_source` field or not, or a list of fields to return.
73+
*/
4674
_source?: SourceConfigParam
75+
/**
76+
* A comma-separated list of source fields to exclude in the response.
77+
*/
4778
_source_excludes?: Fields
79+
/**
80+
* A comma-separated list of source fields to include in the response.
81+
*/
4882
_source_includes?: Fields
83+
/**
84+
* Explicit version number for concurrency control.
85+
* The specified version must match the current version of the document for the request to succeed.
86+
*/
4987
version?: VersionNumber
88+
/**
89+
* Specific version type: `external`, `external_gte`.
90+
*/
5091
version_type?: VersionType
5192
}
5293
}

specification/_global/explain/ExplainRequest.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,81 @@ import { SourceConfigParam } from '@global/search/_types/SourceFilter'
2424
import { Operator } from '@_types/query_dsl/Operator'
2525

2626
/**
27+
* Returns information about why a specific document matches (or doesn’t match) a query.
2728
* @rest_spec_name explain
2829
* @availability stack since=0.0.0 stability=stable
2930
*/
3031
export interface Request extends RequestBase {
3132
path_parts: {
33+
/**
34+
* Defines the document ID.
35+
*/
3236
id: Id
37+
/**
38+
* Index names used to limit the request.
39+
* Only a single index name can be provided to this parameter.
40+
*/
3341
index: IndexName
3442
}
3543
query_parameters: {
44+
/**
45+
* Analyzer to use for the query string.
46+
* This parameter can only be used when the `q` query string parameter is specified.
47+
*/
3648
analyzer?: string
49+
/**
50+
* If `true`, wildcard and prefix queries are analyzed.
51+
* @server_default false
52+
*/
3753
analyze_wildcard?: boolean
54+
/**
55+
* The default operator for query string query: `AND` or `OR`.
56+
* @server_default OR
57+
*/
3858
default_operator?: Operator
59+
/**
60+
* Field to use as default where no field prefix is given in the query string.
61+
*/
3962
df?: string
63+
/**
64+
* If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.
65+
* @server_default false
66+
*/
4067
lenient?: boolean
68+
/**
69+
* Specifies the node or shard the operation should be performed on.
70+
* Random by default.
71+
*/
4172
preference?: string
73+
/**
74+
* Custom value used to route operations to a specific shard.
75+
*/
4276
routing?: Routing
77+
/**
78+
* True or false to return the `_source` field or not, or a list of fields to return.
79+
*/
4380
_source?: SourceConfigParam
81+
/**
82+
* A comma-separated list of source fields to exclude from the response.
83+
*/
4484
_source_excludes?: Fields
85+
/**
86+
* A comma-separated list of source fields to include in the response.
87+
*/
4588
_source_includes?: Fields
89+
/**
90+
* A comma-separated list of stored fields to return in the response.
91+
*/
4692
stored_fields?: Fields
93+
/**
94+
* Query in the Lucene query string syntax.
95+
*/
4796
q?: string
4897
}
4998
body: {
99+
/**
100+
* Defines the search definition using the Query DSL.
101+
*/
50102
query?: QueryContainer
51103
}
52104
}

specification/_global/get/GetRequest.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface Request extends RequestBase {
4646
*/
4747
preference?: string
4848
/**
49-
* Boolean) If true, the request is real-time as opposed to near-real-time.
49+
* If `true`, the request is real-time as opposed to near-real-time.
5050
* @server_default true
5151
* @doc_id realtime
5252
*/
@@ -73,6 +73,11 @@ export interface Request extends RequestBase {
7373
* A comma-separated list of source fields to include in the response.
7474
*/
7575
_source_includes?: Fields
76+
/**
77+
* List of stored fields to return as part of a hit.
78+
* If no fields are specified, no stored fields are included in the response.
79+
* If this field is specified, the `_source` parameter defaults to false.
80+
*/
7681
stored_fields?: Fields
7782
/**
7883
* Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.

specification/_global/index/IndexRequest.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,85 @@ import { long } from '@_types/Numeric'
3333
import { Duration } from '@_types/Time'
3434

3535
/**
36+
* Adds a JSON document to the specified data stream or index and makes it searchable.
37+
* If the target is an index and the document already exists, the request updates the document and increments its version.
3638
* @rest_spec_name index
3739
* @availability stack since=0.0.0 stability=stable
3840
* @availability serverless stability=stable visibility=public
3941
*/
4042
export interface Request<TDocument> extends RequestBase {
4143
path_parts: {
44+
/**
45+
* Unique identifier for the document.
46+
*/
4247
id?: Id
48+
/**
49+
* Name of the data stream or index to target.
50+
*/
4351
index: IndexName
4452
}
4553
query_parameters: {
54+
/**
55+
* Only perform the operation if the document has this primary term.
56+
*/
4657
if_primary_term?: long
58+
/**
59+
* Only perform the operation if the document has this sequence number.
60+
*/
4761
if_seq_no?: SequenceNumber
62+
/**
63+
* Set to create to only index the document if it does not already exist (put if absent).
64+
* If a document with the specified `_id` already exists, the indexing operation will fail.
65+
* Same as using the `<index>/_create` endpoint.
66+
* Valid values: `index`, `create`.
67+
* If document id is specified, it defaults to `index`.
68+
* Otherwise, it defaults to `create`.
69+
*/
4870
op_type?: OpType
71+
/**
72+
* ID of the pipeline to use to preprocess incoming documents.
73+
* If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request.
74+
* If a final pipeline is configured it will always run, regardless of the value of this parameter.
75+
*/
4976
pipeline?: string
77+
/**
78+
* If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes.
79+
* Valid values: `true`, `false`, `wait_for`.
80+
*/
5081
refresh?: Refresh
82+
/**
83+
* Custom value used to route operations to a specific shard.
84+
*/
5185
routing?: Routing
86+
/**
87+
* Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.
88+
* @server_default 1m
89+
*/
5290
timeout?: Duration
91+
/**
92+
* Explicit version number for concurrency control.
93+
* The specified version must match the current version of the document for the request to succeed.
94+
*/
5395
version?: VersionNumber
96+
/**
97+
* Specific version type: `external`, `external_gte`.
98+
*/
5499
version_type?: VersionType
100+
/**
101+
* The number of shard copies that must be active before proceeding with the operation.
102+
* Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
103+
* @server_default 1
104+
*/
55105
wait_for_active_shards?: WaitForActiveShards
106+
/**
107+
* If `true`, the destination must be an index alias.
108+
* @server_default false
109+
*/
56110
require_alias?: boolean
57111
}
58112
/** @codegen_name document */
113+
/**
114+
* Request body contains the JSON source for the document data.
115+
*/
59116
body?: TDocument
60117
}

specification/_global/msearch_template/MultiSearchTemplateRequest.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,38 @@ import { RequestItem } from './types'
3131
*/
3232
export interface Request extends RequestBase {
3333
path_parts: {
34+
/**
35+
* Comma-separated list of data streams, indices, and aliases to search.
36+
* Supports wildcards (`*`).
37+
* To search all data streams and indices, omit this parameter or use `*`.
38+
*/
3439
index?: Indices
3540
}
3641
query_parameters: {
42+
/**
43+
* If `true`, network round-trips are minimized for cross-cluster search requests.
44+
* @server_default true
45+
*/
3746
ccs_minimize_roundtrips?: boolean
47+
/**
48+
* Maximum number of concurrent searches the API can run.
49+
*/
3850
max_concurrent_searches?: long
51+
/**
52+
* The type of the search operation.
53+
* Available options: `query_then_fetch`, `dfs_query_then_fetch`.
54+
*/
3955
search_type?: SearchType
56+
/**
57+
* If `true`, the response returns `hits.total` as an integer.
58+
* If `false`, it returns `hits.total` as an object.
59+
* @server_default false
60+
*/
4061
rest_total_hits_as_int?: boolean
62+
/**
63+
* If `true`, the response prefixes aggregation and suggester names with their respective types.
64+
* @server_default false
65+
*/
4166
typed_keys?: boolean
4267
}
4368
/** @codegen_name search_templates */

specification/_global/msearch_template/types.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,24 @@ import { MultisearchHeader } from '@global/msearch/types'
2626
export type RequestItem = MultisearchHeader | TemplateConfig
2727

2828
export class TemplateConfig {
29-
/** @server_default false */
29+
/**
30+
* If `true`, returns detailed information about score calculation as part of each hit.
31+
* @server_default false */
3032
explain?: boolean
3133
/**
3234
* ID of the search template to use. If no source is specified,
3335
* this parameter is required.
3436
*/
3537
id?: Id
38+
/**
39+
* Key-value pairs used to replace Mustache variables in the template.
40+
* The key is the variable name.
41+
* The value is the variable value.
42+
*/
3643
params?: Dictionary<string, UserDefinedValue>
37-
/** @server_default false */
44+
/**
45+
* If `true`, the query execution is profiled.
46+
* @server_default false */
3847
profile?: boolean
3948
/**
4049
* An inline search template. Supports the same parameters as the search API's

0 commit comments

Comments
 (0)