Skip to content

Commit b82a7a8

Browse files
authored
[Part One] Add common request/response schema descriptions (#851)
* Add common request/response schema descriptions Signed-off-by: Archer <[email protected]>
1 parent 3c22a3e commit b82a7a8

File tree

1 file changed

+103
-30
lines changed

1 file changed

+103
-30
lines changed

spec/schemas/_common.yaml

+103-30
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ components:
88
schemas:
99
Type:
1010
type: string
11+
description: The type of document or resource.
1112
x-version-removed: '2.0'
1213
Id:
1314
type: string
15+
description: The unique identifier for a resource.
1416
AcknowledgedResponseBase:
1517
type: object
1618
properties:
@@ -20,137 +22,164 @@ components:
2022
required:
2123
- acknowledged
2224
DocStatus:
23-
description: |-
24-
The item level REST category class codes during indexing.
25+
description: The item level HTTP response status code during indexing.
2526
type: object
2627
properties:
2728
1xx:
2829
type: integer
2930
format: int32
31+
description: The number of informational responses.
3032
2xx:
3133
type: integer
3234
format: int32
35+
description: The number of successful responses.
3336
3xx:
3437
type: integer
3538
format: int32
39+
description: The number of redirection responses.
3640
4xx:
3741
type: integer
3842
format: int32
43+
description: The number of client error responses.
3944
5xx:
4045
type: integer
4146
format: int32
47+
description: The number of server error responses.
4248
Duration:
43-
description: |-
44-
A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and
45-
`d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
49+
description: A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts `0` without a unit and `-1` to indicate an unspecified value.
4650
pattern: ^(?:(-1)|([0-9\.]+)(?:d|h|m|s|ms|micros|nanos))$
4751
type: string
4852
Metadata:
4953
type: object
54+
description: The custom metadata attached to a resource.
5055
additionalProperties: true
5156
GeoBounds:
5257
description: |-
5358
A geo-bounding box. It can be represented in the following ways:
54-
- As 4 top/bottom/left/right coordinates.
55-
- As 2 top_left/bottom_right points.
56-
- As 2 top_right/bottom_left points.
57-
- As a Well Known Text (WKT) bounding box.
59+
- As 4 top/bottom/left/right coordinates.
60+
- As 2 top_left/bottom_right points.
61+
- As 2 top_right/bottom_left points.
62+
- As a Well Known Text (WKT) bounding box.
5863
oneOf:
5964
- title: coords
65+
description: The bounds specified using coordinate values.
6066
$ref: '#/components/schemas/CoordsGeoBounds'
6167
- title: tlbr
68+
description: The bounds specified using upper-left and lower-right points.
6269
$ref: '#/components/schemas/TopLeftBottomRightGeoBounds'
6370
- title: trbl
71+
description: The bounds specified using upper-right and lower-left points.
6472
$ref: '#/components/schemas/TopRightBottomLeftGeoBounds'
6573
- title: wkt
74+
description: The bounds specified using WKT format.
6675
$ref: '#/components/schemas/WktGeoBounds'
6776
CoordsGeoBounds:
6877
type: object
78+
description: The geographical bounds specified using coordinate values.
6979
properties:
7080
top:
7181
type: number
7282
format: double
83+
description: The top boundary latitude.
7384
bottom:
7485
type: number
7586
format: double
87+
description: The bottom boundary latitude.
7688
left:
7789
type: number
7890
format: double
91+
description: The left boundary longitude.
7992
right:
8093
type: number
8194
format: double
95+
description: The right boundary longitude.
8296
required:
8397
- bottom
8498
- left
8599
- right
86100
- top
87101
TopLeftBottomRightGeoBounds:
88102
type: object
103+
description: The geographical bounds specified using upper-left and lower-right points.
89104
properties:
90105
top_left:
91106
$ref: '#/components/schemas/GeoLocation'
107+
description: The upper-left corner coordinates.
92108
bottom_right:
93109
$ref: '#/components/schemas/GeoLocation'
110+
description: The lower-right corner coordinates.
94111
required:
95112
- bottom_right
96113
- top_left
97114
GeoLocation:
98-
description: |-
115+
description: |-
99116
A latitude/longitude as a two-dimensional point. It can be represented in the following ways:
100-
- As a `{lat, long}` object.
101-
- As a geohash value.
102-
- As a `[lon, lat]` array.
103-
- As a string in `"<lat>, <lon>"` or WKT point format.
117+
- As a `{lat, long}` object.
118+
- As a geohash value.
119+
- As a `[lon, lat]` array.
120+
- As a string in `<lat>, <lon>` or WKT point format.
104121
oneOf:
105122
- title: latlon
123+
description: The location specified using latitude and longitude coordinates.
106124
$ref: '#/components/schemas/LatLonGeoLocation'
107125
- title: geohash
126+
description: The location specified using a geohash value.
108127
$ref: '#/components/schemas/GeoHashLocation'
109128
- title: coords
129+
description: The location specified as an array of `[longitude, latitude]`.
110130
type: array
111131
items:
112132
type: number
113133
format: double
114134
- title: text
135+
description: The location specified as a string in `lat,lon` or WKT format.
115136
type: string
116137
LatLonGeoLocation:
117138
type: object
139+
description: The geographical location specified using latitude and longitude.
118140
properties:
119141
lat:
120-
description: Latitude
142+
description: The latitude coordinate.
121143
type: number
122144
format: double
123145
lon:
124-
description: Longitude
146+
description: The longitude coordinate.
125147
type: number
126148
format: double
127149
required:
128150
- lat
129151
- lon
130152
GeoHashLocation:
131153
type: object
154+
description: The geographical location specified using a geohash.
132155
properties:
133156
geohash:
134157
$ref: '#/components/schemas/GeoHash'
135158
required:
136159
- geohash
137160
GeoHash:
138161
type: string
162+
description: The geohash string representation of a geographical location.
139163
TopRightBottomLeftGeoBounds:
140164
type: object
165+
description: The geographical bounds specified using upper-right and lower-left points.
141166
properties:
142167
top_right:
143168
$ref: '#/components/schemas/GeoLocation'
169+
description: The upper-right corner coordinates.
144170
bottom_left:
145171
$ref: '#/components/schemas/GeoLocation'
172+
description: The lower-left corner coordinates.
146173
required:
147174
- bottom_left
148175
- top_right
149176
WktGeoBounds:
150177
type: object
178+
description: The geographical bounds specified using Well-Known Text (WKT) format.
151179
properties:
152180
wkt:
153181
type: string
182+
description: The WKT string representation of the geographical bounds.
154183
required:
155184
- wkt
156185
XyLocation:
@@ -162,17 +191,21 @@ components:
162191
- As a string in `"x, y"` or WKT point format.
163192
oneOf:
164193
- title: cartesian
194+
description: The location specified using x and y coordinates.
165195
$ref: '#/components/schemas/XyCartesianCoordinates'
166196
- title: coords
197+
description: The location specified as an array of [x, y] coordinates.
167198
type: array
168199
items:
169200
type: number
170201
format: double
171202
- title: text
203+
description: The location specified as a string in `x,y` or WKT format.
172204
type: string
173205
XyCartesianCoordinates:
174206
x-version-added: '2.4'
175207
type: object
208+
description: The Cartesian coordinates specified using x and y values.
176209
properties:
177210
x:
178211
description: The x coordinate.
@@ -524,52 +557,75 @@ components:
524557
MultiTermQueryRewrite:
525558
oneOf:
526559
- type: string
527-
enum:
528-
- constant_score
529-
- constant_score_boolean
530-
- scoring_boolean
560+
const: constant_score
561+
description: The constant score rewrite method assigns the same score to all matching documents.
562+
- type: string
563+
const: constant_score_boolean
564+
description: The constant score Boolean rewrite method creates a Boolean query with a constant score.
565+
- type: string
566+
const: scoring_boolean
567+
description: The scoring Boolean rewrite method creates a Boolean query that scores each term separately.
568+
- type: string
569+
pattern: top_terms(_blended_freqs|_boost)?_\d+
570+
description: The top terms query rewrite method with optional parameters.
531571
- type: string
532572
pattern: top_terms(_blended_freqs|_boost)?_\d+
573+
description: The top terms query rewrite method with optional parameters.
533574
Fuzziness:
534575
oneOf:
535576
- type: string
577+
description: The fuzziness value as `AUTO`, or a string edit distance.
536578
- type: integer
579+
description: The fuzziness value as a numeric edit distance.
537580
format: int32
538581
GeoDistanceType:
539-
type: string
540-
enum:
541-
- arc
542-
- plane
582+
oneOf:
583+
- type: string
584+
const: arc
585+
description: The arc calculation method uses great circle distance.
586+
- type: string
587+
const: plane
588+
description: The plane calculation method uses faster but less accurate flat-earth distance.
543589
Name:
544590
type: string
591+
description: The name of a resource or configuration element.
545592
ScriptField:
546593
type: object
594+
description: The configuration for a script field.
547595
properties:
548596
script:
549597
$ref: '#/components/schemas/Script'
598+
description: The script to execute for this field.
550599
ignore_failure:
551600
type: boolean
601+
description: Whether to ignore failures during script execution.
552602
required:
553603
- script
554604
Sort:
555605
oneOf:
556606
- $ref: '#/components/schemas/SortOptions'
607+
description: The single sort option.
557608
- type: array
609+
description: The list of sort options.
558610
items:
559611
$ref: '#/components/schemas/SortOptions'
560612
SortOptions:
561613
oneOf:
562614
- type: string
563615
const: _score
616+
description: Sort by document score.
564617
- type: string
565618
const: _doc
619+
description: Sort by document index order.
566620
- type: string
621+
description: Sort by field name.
567622
not:
568623
type: string
569624
enum:
570625
- _doc
571626
- _score
572627
- type: object
628+
description: Sort by score options.
573629
properties:
574630
_score:
575631
$ref: '#/components/schemas/ScoreSort'
@@ -582,6 +638,7 @@ components:
582638
minProperties: 1
583639
maxProperties: 1
584640
- type: object
641+
description: Sort by field options.
585642
propertyNames:
586643
allOf:
587644
- $ref: '#/components/schemas/Field'
@@ -599,30 +656,46 @@ components:
599656
FieldSort:
600657
oneOf:
601658
- title: order
659+
description: The sort order direction.
602660
$ref: '#/components/schemas/SortOrder'
603661
- type: object
662+
description: The detailed field sort options.
604663
properties:
605664
missing:
606665
$ref: '#/components/schemas/FieldValue'
666+
description: The value to use when the field is missing.
607667
mode:
608668
$ref: '#/components/schemas/SortMode'
669+
description: The mode for sorting on array fields.
609670
nested:
610671
$ref: '#/components/schemas/NestedSortValue'
672+
description: The nested path sort options.
611673
order:
612674
$ref: '#/components/schemas/SortOrder'
675+
description: The sort order direction.
613676
unmapped_type:
614677
$ref: '_common.mapping.yaml#/components/schemas/FieldType'
678+
description: The type to use for unmapped fields.
615679
numeric_type:
616680
$ref: '#/components/schemas/FieldSortNumericType'
681+
description: The numeric type to use for sorting.
617682
format:
618683
type: string
684+
description: The format to use for the sort values.
619685
FieldSortNumericType:
620-
type: string
621-
enum:
622-
- date
623-
- date_nanos
624-
- double
625-
- long
686+
oneOf:
687+
- type: string
688+
const: date
689+
description: The field contains date values.
690+
- type: string
691+
const: date_nanos
692+
description: The field contains date values with nanosecond precision.
693+
- type: string
694+
const: double
695+
description: The field contains double-precision floating-point values.
696+
- type: string
697+
const: long
698+
description: The field contains long integer values.
626699
ScoreSort:
627700
type: object
628701
properties:

0 commit comments

Comments
 (0)