File tree 4 files changed +237
-6
lines changed
tests/default/_core/search/query
4 files changed +237
-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
+ # Setup for movies index with all necessary fields
8
+ - path : /movies
9
+ method : PUT
10
+ request :
11
+ payload :
12
+ mappings :
13
+ properties :
14
+ title :
15
+ type : text
16
+ genre :
17
+ type : keyword
18
+ director_id :
19
+ type : keyword
20
+ status : [200]
21
+
22
+ - path : /movies/_doc
23
+ method : POST
24
+ parameters :
25
+ refresh : true
26
+ request :
27
+ payload :
28
+ title : The Lion King
29
+ genre : animation
30
+ status : [201]
31
+
32
+ - path : /movies/_doc
33
+ method : POST
34
+ parameters :
35
+ refresh : true
36
+ request :
37
+ payload :
38
+ title : Beauty and the Beast
39
+ genre : adventure
40
+ status : [201]
41
+
42
+ # Setup for games index with all necessary fields
43
+ - path : /games
44
+ method : PUT
45
+ request :
46
+ payload :
47
+ mappings :
48
+ properties :
49
+ title :
50
+ type : text
51
+ genre :
52
+ type : keyword
53
+ developer_id :
54
+ type : keyword
55
+ status : [200]
56
+
57
+ - path : /games/_doc
58
+ method : POST
59
+ parameters :
60
+ refresh : true
61
+ request :
62
+ payload :
63
+ title : Monopoly
64
+ genre : RPG
65
+ status : [201]
66
+
67
+ - path : /games/_doc
68
+ method : POST
69
+ parameters :
70
+ refresh : true
71
+ request :
72
+ payload :
73
+ title : Cyberpunk 2077
74
+ genre : RPG
75
+ status : [201]
76
+
77
+ epilogues :
78
+ - path : /movies
79
+ method : DELETE
80
+ status : [200, 404]
81
+
82
+ - path : /games
83
+ method : DELETE
84
+ status : [200, 404]
85
+
86
+ chapters :
87
+ # Test for TermsQuery with an array of terms
88
+ - synopsis : Search using TermsQuery with an array of terms.
89
+ path : /{index}/_search
90
+ parameters :
91
+ index : movies
92
+ method : GET
93
+ request :
94
+ payload :
95
+ query :
96
+ terms :
97
+ genre :
98
+ - adventure
99
+ - animation
100
+ response :
101
+ status : 200
102
+ payload :
103
+ timed_out : false
104
+ hits :
105
+ total :
106
+ value : 2
107
+ relation : eq
108
+ hits :
109
+ - _index : movies
110
+ _score : 1
111
+ _source :
112
+ title : The Lion King
113
+ genre : animation
114
+ - _index : movies
115
+ _score : 1
116
+ _source :
117
+ title : Beauty and the Beast
118
+ genre : adventure
119
+
120
+ # Test for TermsQuery with an array of terms in games index
121
+ - synopsis : Search using TermsQuery with an array of terms in the games index.
122
+ path : /{index}/_search
123
+ parameters :
124
+ index : games
125
+ method : GET
126
+ request :
127
+ payload :
128
+ query :
129
+ terms :
130
+ genre :
131
+ - RPG
132
+ response :
133
+ status : 200
134
+ payload :
135
+ timed_out : false
136
+ hits :
137
+ total :
138
+ value : 2
139
+ relation : eq
140
+ hits :
141
+ - _index : games
142
+ _score : 1
143
+ _source :
144
+ title : Monopoly
145
+ genre : RPG
146
+ - _index : games
147
+ _score : 1
148
+ _source :
149
+ title : Cyberpunk 2077
150
+ 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