File tree 4 files changed +236
-6
lines changed
tests/default/_core/search/query
4 files changed +236
-6
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
84
84
- Added ` AwarenessAttributeStats ` to ` /_cluster/health ` ([ #534 ] ( https://github.com/opensearch-project/opensearch-api-specification/pull/534 ) )
85
85
- Added ` cache_reserved_in_bytes ` to ` ClusterFileSystem ` ([ #534 ] ( https://github.com/opensearch-project/opensearch-api-specification/pull/534 ) )
86
86
- Added ` cluster_manager ` to ` ClusterNodeCount ` ([ #534 ] ( https://github.com/opensearch-project/opensearch-api-specification/pull/534 ) )
87
+ - Added support for ` query ` with ` terms ` in ` _search ` ([ #546 ] ( https://github.com/opensearch-project/opensearch-api-specification/pull/546 ) ).
87
88
88
89
### Changed
89
90
Original file line number Diff line number Diff line change @@ -280,6 +280,23 @@ components:
280
280
type : number
281
281
_name :
282
282
type : string
283
+ Terms :
284
+ oneOf :
285
+ - type : array
286
+ items :
287
+ type : string
288
+ - type : object
289
+ properties :
290
+ index :
291
+ $ref : ' _common.yaml#/components/schemas/IndexName'
292
+ id :
293
+ $ref : ' _common.yaml#/components/schemas/Id'
294
+ path :
295
+ $ref : ' _common.yaml#/components/schemas/Field'
296
+ routing :
297
+ $ref : ' _common.yaml#/components/schemas/Routing'
298
+ additionalProperties : true
299
+ description : Object for fetching terms.
283
300
BoostingQuery :
284
301
allOf :
285
302
- $ref : ' #/components/schemas/QueryBase'
@@ -1857,9 +1874,9 @@ components:
1857
1874
required :
1858
1875
- value
1859
1876
TermsQuery :
1860
- allOf :
1877
+ anyOf :
1861
1878
- $ref : ' #/components/schemas/QueryBase'
1862
- - type : object
1879
+ - $ref : ' #/components/schemas/Terms '
1863
1880
TermsSetQuery :
1864
1881
allOf :
1865
1882
- $ref : ' #/components/schemas/QueryBase'
@@ -1870,10 +1887,7 @@ components:
1870
1887
minimum_should_match_script :
1871
1888
$ref : ' _common.yaml#/components/schemas/Script'
1872
1889
terms :
1873
- description : Array of terms you wish to find in the provided field.
1874
- type : array
1875
- items :
1876
- type : string
1890
+ $ref : ' #/components/schemas/Terms'
1877
1891
required :
1878
1892
- terms
1879
1893
TextExpansionQuery :
Original file line number Diff line number Diff line change
1
+ $schema : ../../../../../json_schemas/test_story.schema.yaml
2
+
3
+ description : Comprehensive test suite for TermsQuery, including array of terms and term lookup.
4
+ version : ' >= 1.2'
5
+
6
+ prologues :
7
+ - path : /movies
8
+ method : PUT
9
+ request :
10
+ payload :
11
+ mappings :
12
+ properties :
13
+ title :
14
+ type : text
15
+ genre :
16
+ type : keyword
17
+ director_id :
18
+ type : keyword
19
+ status : [200]
20
+
21
+ - path : /movies/_doc
22
+ method : POST
23
+ parameters :
24
+ refresh : true
25
+ request :
26
+ payload :
27
+ title : The Lion King
28
+ genre : animation
29
+ status : [201]
30
+
31
+ - path : /movies/_doc
32
+ method : POST
33
+ parameters :
34
+ refresh : true
35
+ request :
36
+ payload :
37
+ title : Beauty and the Beast
38
+ genre : adventure
39
+ status : [201]
40
+
41
+ # Setup for games index with all necessary fields
42
+ - path : /games
43
+ method : PUT
44
+ request :
45
+ payload :
46
+ mappings :
47
+ properties :
48
+ title :
49
+ type : text
50
+ genre :
51
+ type : keyword
52
+ developer_id :
53
+ type : keyword
54
+ status : [200]
55
+
56
+ - path : /games/_doc
57
+ method : POST
58
+ parameters :
59
+ refresh : true
60
+ request :
61
+ payload :
62
+ title : Monopoly
63
+ genre : RPG
64
+ status : [201]
65
+
66
+ - path : /games/_doc
67
+ method : POST
68
+ parameters :
69
+ refresh : true
70
+ request :
71
+ payload :
72
+ title : Cyberpunk 2077
73
+ genre : RPG
74
+ status : [201]
75
+
76
+ epilogues :
77
+ - path : /movies
78
+ method : DELETE
79
+ status : [200, 404]
80
+
81
+ - path : /games
82
+ method : DELETE
83
+ status : [200, 404]
84
+
85
+ chapters :
86
+ # Test for TermsQuery with an array of terms
87
+ - synopsis : Search using TermsQuery with an array of terms.
88
+ path : /{index}/_search
89
+ parameters :
90
+ index : movies
91
+ method : GET
92
+ request :
93
+ payload :
94
+ query :
95
+ terms :
96
+ genre :
97
+ - adventure
98
+ - animation
99
+ response :
100
+ status : 200
101
+ payload :
102
+ timed_out : false
103
+ hits :
104
+ total :
105
+ value : 2
106
+ relation : eq
107
+ hits :
108
+ - _index : movies
109
+ _score : 1
110
+ _source :
111
+ title : The Lion King
112
+ genre : animation
113
+ - _index : movies
114
+ _score : 1
115
+ _source :
116
+ title : Beauty and the Beast
117
+ genre : adventure
118
+
119
+ # Test for TermsQuery with an array of terms in games index
120
+ - synopsis : Search using TermsQuery with an array of terms in the games index.
121
+ path : /{index}/_search
122
+ parameters :
123
+ index : games
124
+ method : GET
125
+ request :
126
+ payload :
127
+ query :
128
+ terms :
129
+ genre :
130
+ - RPG
131
+ response :
132
+ status : 200
133
+ payload :
134
+ timed_out : false
135
+ hits :
136
+ total :
137
+ value : 2
138
+ relation : eq
139
+ hits :
140
+ - _index : games
141
+ _score : 1
142
+ _source :
143
+ title : Monopoly
144
+ genre : RPG
145
+ - _index : games
146
+ _score : 1
147
+ _source :
148
+ title : Cyberpunk 2077
149
+ genre : RPG
Original file line number Diff line number Diff line change
1
+ $schema : ../../../../../json_schemas/test_story.schema.yaml
2
+
3
+ description : Test TermsSetQuery functionality with complex example using movies.
4
+ version : ' >= 1.2'
5
+
6
+ prologues :
7
+ - path : /movies
8
+ method : PUT
9
+ request :
10
+ payload :
11
+ mappings :
12
+ properties :
13
+ title :
14
+ type : keyword
15
+ genres :
16
+ type : keyword
17
+ min_required_genres :
18
+ type : integer
19
+
20
+ - path : /movies/_doc/1
21
+ method : POST
22
+ parameters :
23
+ refresh : true
24
+ request :
25
+ payload :
26
+ title : The Lion King
27
+ genres : [Adventure, Animation, Family]
28
+ min_required_genres : 2
29
+ status : [201]
30
+
31
+ - path : /movies/_doc/2
32
+ method : POST
33
+ parameters :
34
+ refresh : true
35
+ request :
36
+ payload :
37
+ title : Beauty and the Beast
38
+ genres : [Animation, Family, Musical]
39
+ min_required_genres : 2
40
+ status : [201]
41
+
42
+ epilogues :
43
+ - path : /movies
44
+ method : DELETE
45
+ status : [200, 404]
46
+
47
+ chapters :
48
+ - synopsis : Search using TermsSetQuery with terms array and minimum_should_match_field.
49
+ path : /{index}/_search
50
+ parameters :
51
+ index : movies
52
+ method : POST
53
+ request :
54
+ payload :
55
+ query :
56
+ terms_set :
57
+ genres :
58
+ terms : [Adventure, Animation, Family]
59
+ minimum_should_match_field : min_required_genres
60
+ response :
61
+ status : 200
62
+ payload :
63
+ timed_out : false
64
+ hits :
65
+ total :
66
+ value : 2
You can’t perform that action at this time.
0 commit comments