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

Conversation

ruai0511
Copy link
Contributor

This change introduces the QueryGroup CRUD API documentation which we will use to enforce node level resiliency as part of this RFC: opensearch-project/OpenSearch#12342. The QueryGroup schema is in this PR: opensearch-project/OpenSearch#13669

Create API:
Request:

curl -XPUT "localhost:9200/_query_group" -H 'Content-Type: application/json' -d ' 
{
     "name": "analytics",
     "jvm":0.4,
     "resiliency_mode": "monitor"
}'

Response:

{"name":"an1alytics","jvm":0.4,"resiliency_mode":"monitor","updatedAt":1718922703953}

Update API:
Request:

curl -XPUT "localhost:9200/_query_group/analytics" -H 'Content-Type: application/json' -d ' 
{
     "jvm":0.3,
     "resiliency_mode": "monitor"
}'

Response:

{"name":"analytics","jvm":0.3,"resiliency_mode":"monitor","updatedAt":1718922977093}

Get API:
Request:

curl -XGET "localhost:9200/_query_group" //get all QueryGroups
curl -XGET "localhost:9200/_query_group/analytics" //get one QueryGroup

Response:

{"query_groups":[{"name":"analytics","resiliency_mode":"monitor","jvm":0.3"updatedAt":1718922344489}]}

Delete API:
Request:

curl -XDELETE "localhost:9200/_query_group" //delete all QueryGroups
curl -XDELETE "localhost:9200/_query_group/analytics" //delete one QueryGroup

Response:

{"deleted":[{"name":"analytics","resiliency_mode":"monitor","jvm":0.3"updatedAt":1718922344489}]}

Copy link
Contributor

github-actions bot commented Jun 21, 2024

Changes Analysis

Commit SHA: 3cf87df
Comparing To SHA: 9193d58

API Changes

Summary

├─┬Paths
│ ├──[➕] path (8492:3)
│ └──[➕] path (8523:3)
└─┬Components
  ├──[➕] requestBodies (24644:7)
  ├──[➕] requestBodies (24650:7)
  ├──[➕] responses (27075:7)
  ├──[➕] responses (27086:7)
  ├──[➕] responses (27066:7)
  ├──[➕] responses (27060:7)
  ├──[➕] parameters (21343:7)
  ├──[➕] parameters (21350:7)
  ├──[➕] parameters (21336:7)
  ├──[➕] schemas (50650:7)
  ├──[➕] schemas (50687:7)
  └──[➕] schemas (50731:7)

Document Element Total Changes Breaking Changes
components 12 0
paths 2 0
  • Total Changes: 14
  • Additions: 14

Report

The full API changes report is available at: https://github.com/opensearch-project/opensearch-api-specification/actions/runs/10836778312/artifacts/1926434731

API Coverage

Before After Δ
Covered (%) 537 (52.6 %) 537 (52.6 %) 0 (0 %)
Uncovered (%) 484 (47.4 %) 484 (47.4 %) 0 (0 %)
Unknown 26 31 5

@dblock
Copy link
Member

dblock commented Jun 21, 2024

Great start! Iterate to 🟢 . Make sure to write a test story in https://github.com/opensearch-project/opensearch-api-specification/tree/main/tests.

@ruai0511
Copy link
Contributor Author

ruai0511 commented Jun 21, 2024

Great start! Iterate to 🟢 . Make sure to write a test story in https://github.com/opensearch-project/opensearch-api-specification/tree/main/tests.

Thanks! I have 2 questions

  1. I saw this error message. Basically it says I need to refer to the same requestBody for path PUT /_query_group and PUT /_query_group/{name}. But we have different schemas for those 2 api paths. Is there a way to have different reference for requestBody for them?
{
  file: 'namespaces/query_group.yaml',
  location: 'Operation: PUT /_query_group',
  message: "The requestBody must be a reference object to '#/components/requestBodies/query_group.put'."
}
{
Error: [ERROR] 
Total errors:2
  file: 'namespaces/query_group.yaml',
  location: 'Operation: PUT /_query_group/{name}',
  message: "The requestBody must be a reference object to '#/components/requestBodies/query_group.put'."
}
  1. Where should I create the test story? Is it okay to create another folder under tests called query_group and put my tests in there?

Looking forward to your response

@dblock
Copy link
Member

dblock commented Jun 21, 2024

For (1) I am not sure, but maybe try using a different operation group? @nhtruong will know for sure.

For (2), this is something under _query_group so make a new query_group folder, the basics should go into index.yaml.

@nhtruong
Copy link
Collaborator

@ruai0511 If 2 operations have different behaviors (having different inputs for example), then they should belong to different operation groups. In this case they can be query_group.create and query_group.update.

@dblock
Copy link
Member

dblock commented Jul 10, 2024

I opened #398 to add support to run tests against the next version of OpenSearch.

@dblock
Copy link
Member

dblock commented Jul 11, 2024

With #410 you can now run tests against the next version of OpenSearch.

Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Copy link
Contributor

Spec Test Coverage Analysis

Total Tested
576 282 (48.96 %)

@dblock
Copy link
Member

dblock commented Nov 7, 2024

This was finished in #649, closing.

@ruai0511 double check that everything in this PR made it there

@dblock dblock closed this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants