Skip to content

Commit 8c03125

Browse files
committed
Fix k-NN tests
Signed-off-by: Thomas Farr <[email protected]>
1 parent 065fe26 commit 8c03125

File tree

4 files changed

+37
-23
lines changed

4 files changed

+37
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
114114
- Fixed GeoDistanceSort schema ([#805](https://github.com/opensearch-project/opensearch-api-specification/pull/805))
115115
- Fixed Aggregation schemas ([#801](https://github.com/opensearch-project/opensearch-api-specification/pull/801))
116116
- Fixed FilterQueryRequestProcessor to use correct query type ([#821](https://github.com/opensearch-project/opensearch-api-specification/pull/821))
117+
- Fixed `knn.train_model`'s request body `method` field to accept an object rather than a string ([#814](https://github.com/opensearch-project/opensearch-api-specification/pull/814))
117118

118119
### Changed
119120
- Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683))

spec/namespaces/knn.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ components:
390390
in: query
391391
description: The default operator for query string query (AND or OR).
392392
schema:
393-
$ref: '../schemas/knn._common.yaml#/components/schemas/DefaultOperator'
393+
$ref: '../schemas/_common.query_dsl.yaml#/components/schemas/Operator'
394394
knn.search_models::query.df:
395395
name: df
396396
in: query
@@ -518,7 +518,7 @@ components:
518518
in: query
519519
description: Search operation type.
520520
schema:
521-
$ref: '../schemas/knn._common.yaml#/components/schemas/SearchType'
521+
$ref: '../schemas/_common.yaml#/components/schemas/SearchType'
522522
knn.search_models::query.seq_no_primary_term:
523523
name: seq_no_primary_term
524524
in: query
@@ -580,7 +580,7 @@ components:
580580
in: query
581581
description: Specify suggest mode.
582582
schema:
583-
$ref: '../schemas/knn._common.yaml#/components/schemas/SuggestMode'
583+
$ref: '../schemas/_common.yaml#/components/schemas/SuggestMode'
584584
knn.search_models::query.suggest_size:
585585
name: suggest_size
586586
in: query

spec/schemas/knn._common.yaml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,6 @@ info:
66
paths: {}
77
components:
88
schemas:
9-
DefaultOperator:
10-
type: string
11-
description: The default operator for query string query (AND or OR).
12-
enum:
13-
- AND
14-
- OR
15-
SearchType:
16-
type: string
17-
description: Search operation type.
18-
enum:
19-
- dfs_query_then_fetch
20-
- query_then_fetch
21-
SuggestMode:
22-
type: string
23-
description: Specify suggest mode.
24-
enum:
25-
- always
26-
- missing
27-
- popular
289
Stats:
2910
type: object
3011
properties:
@@ -143,6 +124,20 @@ components:
143124
$ref: '_common.yaml#/components/schemas/ByteCount'
144125
current_size_in_bytes:
145126
$ref: '_common.yaml#/components/schemas/ByteCount'
127+
KnnMethod:
128+
type: object
129+
properties:
130+
name:
131+
type: string
132+
space_type:
133+
type: string
134+
engine:
135+
type: string
136+
parameters:
137+
type: object
138+
additionalProperties: true
139+
required:
140+
- name
146141
TrainedModel:
147142
type: object
148143
properties:
@@ -166,7 +161,7 @@ components:
166161
compression_level:
167162
type: string
168163
method:
169-
type: string
164+
$ref: '#/components/schemas/KnnMethod'
170165
spaceType:
171166
type: string
172167
required:

tests/default/knn/models/train.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ chapters:
7070
mode: on_disk
7171
compression_level: 32x
7272
spaceType: l2
73+
method:
74+
name: ivf
75+
engine: faiss
76+
parameters:
77+
nlist: 9
78+
encoder:
79+
name: pq
80+
parameters:
81+
code_size: 3
7382
response:
7483
status: 200
7584
output:
@@ -104,5 +113,14 @@ chapters:
104113
mode: on_disk
105114
compression_level: 32x
106115
spaceType: l2
116+
method:
117+
name: ivf
118+
engine: faiss
119+
parameters:
120+
nlist: 9
121+
encoder:
122+
name: pq
123+
parameters:
124+
code_size: 3
107125
response:
108126
status: 200

0 commit comments

Comments
 (0)