Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QueryGroup API documentation #356

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `/_plugins/_flow_framework` ([#508](https://github.com/opensearch-project/opensearch-api-specification/issues/508))
- Added `AwarenessAttributeStats` to `/_cluster/health` ([#534](https://github.com/opensearch-project/opensearch-api-specification/pull/534))
- Added `cache_reserved_in_bytes` to `ClusterFileSystem` ([#534](https://github.com/opensearch-project/opensearch-api-specification/pull/534))
- Added QueryGroup API documentation ([#356](https://github.com/opensearch-project/opensearch-api-specification/pull/356))
- Added `cluster_manager` to `ClusterNodeCount` ([#534](https://github.com/opensearch-project/opensearch-api-specification/pull/534))
- Added support for `query` with `terms` in `_search` ([#546](https://github.com/opensearch-project/opensearch-api-specification/pull/546))
- Added `h`, `bytes`, `time` parameters to cat API tests ([#551](https://github.com/opensearch-project/opensearch-api-specification/pull/551))
Expand Down
127 changes: 127 additions & 0 deletions spec/namespaces/query_group.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
openapi: 3.1.0
info:
title: OpenSearch QueryGroup API
description: OpenSearch QueryGroup API
version: 1.0.0
paths:
/_wlm/query_group:
get:
operationId: query_group.get.0
x-operation-group: query_group.get
x-version-added: '2.17'
description: Gets the specified QueryGroup or get all if no name is provided.
responses:
'200':
$ref: '#/components/responses/query_group.get@200'
put:
operationId: query_group.create.0
x-operation-group: query_group.create
x-version-added: '2.17'
description: Creates a specified query group.
requestBody:
$ref: '#/components/requestBodies/query_group.create'
responses:
'200':
$ref: '#/components/responses/query_group.create@200'
/_wlm/query_group/{name}:
get:
operationId: query_group.get.1
x-operation-group: query_group.get
x-version-added: '2.17'
description: Gets the specified QueryGroup or get all if no name is provided.
parameters:
- $ref: '#/components/parameters/query_group.get::path.name'
responses:
'200':
$ref: '#/components/responses/query_group.get@200'
put:
operationId: query_group.update.0
x-operation-group: query_group.update
x-version-added: '2.17'
description: Updates a specified query group.
parameters:
- $ref: '#/components/parameters/query_group.update::path.name'
requestBody:
$ref: '#/components/requestBodies/query_group.update'
responses:
'200':
$ref: '#/components/responses/query_group.update@200'
delete:
operationId: query_group.delete.1
x-operation-group: query_group.delete
x-version-added: '2.17'
description: Deletes the specified QueryGroups or delete all if no name is provided.
parameters:
- $ref: '#/components/parameters/query_group.delete::path.name'
responses:
'200':
$ref: '#/components/responses/query_group.delete@200'
components:
requestBodies:
query_group.create:
content:
application/json:
schema:
$ref: '../schemas/query_group._common.yaml#/components/schemas/QueryGroupCreate'

Check failure on line 65 in spec/namespaces/query_group.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 12 spaces but found 14 spaces
ruai0511 marked this conversation as resolved.
Show resolved Hide resolved
required: true
query_group.update:
content:
application/json:
schema:
$ref: '../schemas/query_group._common.yaml#/components/schemas/QueryGroupUpdate'

Check failure on line 71 in spec/namespaces/query_group.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 12 spaces but found 14 spaces
ruai0511 marked this conversation as resolved.
Show resolved Hide resolved
required: true
responses:
query_group.create@200:
description: ''
content:
application/json:
schema:
$ref: '../schemas/query_group._common.yaml#/components/schemas/QueryGroupResponse'
query_group.update@200:
description: ''
content:
application/json:
schema:
$ref: '../schemas/query_group._common.yaml#/components/schemas/QueryGroupResponse'
query_group.delete@200:
description: ''
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
query_group.get@200:
description: ''
content:
application/json:
schema:
type: object
properties:
query_groups:
type: array
items:
$ref: '../schemas/query_group._common.yaml#/components/schemas/QueryGroupResponse'
parameters:
query_group.update::path.name:
name: name
in: path
description: QueryGroup name.
schema:
type: string
required: true
query_group.delete::path.name:
name: name
in: path
description: QueryGroup name.
schema:
type: string
required: true
query_group.get::path.name:
name: name
in: path
description: QueryGroup name.
schema:
type: string
required: true
98 changes: 98 additions & 0 deletions spec/schemas/query_group._common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
openapi: 3.1.0
info:
title: Schemas of query_group._common category
description: Schemas of query_group._common category
version: 1.0.0
paths: {}
components:
schemas:
QueryGroupResponse:
type: object
properties:
_id:
type: string
name:
type: string
resiliency_mode:
type: string
enum: [ "soft", "enforced", "monitor" ]

Check failure on line 18 in spec/schemas/query_group._common.yaml

View workflow job for this annotation

GitHub Actions / lint

There should be no space after '['

Check failure on line 18 in spec/schemas/query_group._common.yaml

View workflow job for this annotation

GitHub Actions / lint

Must use plain style scalar

Check failure on line 18 in spec/schemas/query_group._common.yaml

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote

Check failure on line 18 in spec/schemas/query_group._common.yaml

View workflow job for this annotation

GitHub Actions / lint

Must use plain style scalar

Check failure on line 18 in spec/schemas/query_group._common.yaml

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote

Check failure on line 18 in spec/schemas/query_group._common.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'enforced' should be before 'soft'

Check failure on line 18 in spec/schemas/query_group._common.yaml

View workflow job for this annotation

GitHub Actions / lint

Must use plain style scalar

Check failure on line 18 in spec/schemas/query_group._common.yaml

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote
updated_at:
type: integer
format: int64
resource_limits:
anyOf:
- type: object
properties:
memory:
type: number
format: double
cpu:
type: number
format: double
required:
- memory
- type: object
properties:
memory:
type: number
format: double
cpu:
type: number
format: double
required:
- cpu
required:
- _id
- name
- resiliency_mode
- updated_at
- resource_limits
QueryGroupCreate:
type: object
properties:
name:
type: string
resiliency_mode:
type: string
enum: [ "soft", "enforced", "monitor" ]
resource_limits:
anyOf:
- type: object
properties:
memory:
type: number
format: double
cpu:
type: number
format: double
required:
- memory
- type: object
properties:
memory:
type: number
format: double
cpu:
type: number
format: double
required:
- cpu
required:
- name
- resiliency_mode
- resource_limits
QueryGroupUpdate:
type: object
properties:
resiliency_mode:
type: string
enum: [ "soft", "enforced", "monitor" ]
resource_limits:
type: object
properties:
memory:
type: number
format: double
cpu:
type: number
format: double
23 changes: 23 additions & 0 deletions tests/query_group/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$schema: ../json_schemas/test_story.schema.yaml

description: This story tests all endpoints relevant to QueryGroups, from creation to deletion.

prologues: []

epilogues:
- path: /_wlm/query_group/analytics
method: DELETE
status: [200, 404]

chapters:
- synopsis: Create an QueryGroup named `analytics`, with resiliency_mode to be monitor and memory to be 0.4.
path: /_wlm/query_group
method: PUT
request_body:
payload:
name: analytics
resource_limits:
memory: 0.4
resiliency_mode: monitor
response:
status: 200
Loading