Skip to content

Commit

Permalink
Term vectors API tests (#734)
Browse files Browse the repository at this point in the history
* added tests for term vectors and removed id from required of termvectors@200

Signed-off-by: Tokesh <[email protected]>

* added type for term vectors, fixing lint

Signed-off-by: Tokesh <[email protected]>

* hotfix path

Signed-off-by: Tokesh <[email protected]>

* adding multi term vectors

Signed-off-by: Tokesh <[email protected]>

* renaming folder and lint fix

Signed-off-by: Tokesh <[email protected]>

* adding type to mterm vector specs

Signed-off-by: Tokesh <[email protected]>

* hotfix of string

Signed-off-by: Tokesh <[email protected]>

* added type to wrong place of specs

Signed-off-by: Tokesh <[email protected]>

* adding core mtermvectors

Signed-off-by: Tokesh <[email protected]>

* using multiple method, fix grammar in changelog

Signed-off-by: Tokesh <[email protected]>

---------

Signed-off-by: Tokesh <[email protected]>
Signed-off-by: Niyazbek Torekeldi <[email protected]>
  • Loading branch information
Tokesh authored Dec 17, 2024
1 parent eb948fb commit b9e9c01
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added response schema for `GET /_plugins/_knn/warmup/{index}` ([#717](https://github.com/opensearch-project/opensearch-api-specification/pull/717))
- Added support for multiple test verbs ([#724](https://github.com/opensearch-project/opensearch-api-specification/pull/724))
- Added support for using a certificate and key in tests ([#731](https://github.com/opensearch-project/opensearch-api-specification/pull/731))
- Added `_type` to `termvector` and `mtermvector` ([#734](https://github.com/opensearch-project/opensearch-api-specification/pull/734))

### Removed
- Removed unsupported `_common.mapping:SourceField`'s `mode` field and associated `_common.mapping:SourceFieldMode` enum ([#652](https://github.com/opensearch-project/opensearch-api-specification/pull/652))
Expand All @@ -45,6 +46,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Removed unsupported `cause` and `create` from `/_index_template/_simulate_index/{name}` ([#691](https://github.com/opensearch-project/opensearch-api-specification/pull/691))
- Removed `mappings` from `required` in `indices.simulate_template#Template` ([#691](https://github.com/opensearch-project/opensearch-api-specification/pull/691))
- Removed `HealthStatusCapatilized` and merged it with `HealthStatus` ([#725](https://github.com/opensearch-project/opensearch-api-specification/pull/725))
- Removed `id` from `required` in `indices.termvectors@200` ([#734](https://github.com/opensearch-project/opensearch-api-specification/pull/734))

### Fixed
- Spec passes OpenAPI 3.1.0 validations ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
Expand Down
3 changes: 2 additions & 1 deletion spec/namespaces/_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3338,8 +3338,9 @@ components:
format: int64
_version:
$ref: '../schemas/_common.yaml#/components/schemas/VersionNumber'
_type:
$ref: '../schemas/_common.yaml#/components/schemas/Type'
required:
- _id
- _index
- _version
- found
Expand Down
2 changes: 2 additions & 0 deletions spec/schemas/_core.mtermvectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ components:
$ref: '_core.termvectors.yaml#/components/schemas/TermVector'
error:
$ref: '_common.yaml#/components/schemas/ErrorCause'
_type:
$ref: '_common.yaml#/components/schemas/Type'
required:
- _id
- _index
44 changes: 44 additions & 0 deletions tests/default/_core/mtermvectors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test _mtermvectors APIs.
prologues:
- path: /books
method: PUT
request:
payload:
mappings:
properties:
author:
type: text
title:
term_vector: yes
type: text
year:
type: integer
- path: /_bulk
method: POST
parameters:
refresh: true
request:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book1}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 1960}
- {create: {_index: books, _id: book2}}
- {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991}
epilogues:
- path: /books
method: DELETE
status: [200, 404]

chapters:
- synopsis: Retrieve term vectors for specific documents.
path: /_mtermvectors
method:
- GET
- POST
request:
payload:
docs:
- _id: book1
_index: books
45 changes: 45 additions & 0 deletions tests/default/indices/mtermvectors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test _mtermvectors APIs.
prologues:
- path: /books
method: PUT
request:
payload:
mappings:
properties:
author:
type: text
title:
term_vector: yes
type: text
year:
type: integer
- path: /_bulk
method: POST
parameters:
refresh: true
request:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book1}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 1960}
- {create: {_index: books, _id: book2}}
- {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991}
epilogues:
- path: /books
method: DELETE
status: [200, 404]

chapters:
- synopsis: Retrieve term vectors for specific documents in an index.
path: /{index}/_mtermvectors
parameters:
index: books
method:
- GET
- POST
request:
payload:
docs:
- _id: book1
53 changes: 53 additions & 0 deletions tests/default/indices/termvectors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test _termvectors APIs.
prologues:
- path: /books
method: PUT
request:
payload:
mappings:
properties:
author:
type: text
title:
term_vector: yes
type: text
year:
type: integer
- path: /_bulk
method: POST
parameters:
refresh: true
request:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book1}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 1960}
- {create: {_index: books, _id: book2}}
- {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991}
epilogues:
- path: /books
method: DELETE
status: [200, 404]

chapters:
- synopsis: Get term vectors for a specific index.
path: /{index}/_termvectors
parameters:
index: books
method:
- GET
- POST
request:
payload:
doc:
title: To kill
- synopsis: Get term vectors for a document by its ID.
path: /{index}/_termvectors/{id}
parameters:
index: books
id: book1
method:
- GET
- POST

0 comments on commit b9e9c01

Please sign in to comment.