From 4615564b05d410575bb6ed3ed34ea136bf2e4312 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Mon, 25 Nov 2024 11:00:47 -0500 Subject: [PATCH] Added missing types for /_delete_by_query/{task_id}/_rethrottle. (#692) Signed-off-by: dblock --- CHANGELOG.md | 1 + spec/schemas/_common.yaml | 39 ++++++++++++++++++ spec/schemas/tasks._common.yaml | 2 + .../indices/delete_by_query/rethrottle.yaml | 40 +++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 tests/default/indices/delete_by_query/rethrottle.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 24c96eac9..1a5b3a68c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `/_list/indices` & `/_list/shards` api specs ([#613](https://github.com/opensearch-project/opensearch-api-specification/pull/613)) - Added `GET` and `HEAD /{index}/_source/{id}` returning `404` ([#673](https://github.com/opensearch-project/opensearch-api-specification/pull/673)) - Added `rename_alias_pattern` and `rename_alias_replacment` to `/_snapshot/{repository}/{snapshot}/_restore` body parameters ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615)) +- Added `resource_stats` to `TaskInfoBase` ([#692](https://github.com/opensearch-project/opensearch-api-specification/pull/692)) - Added `s` to `/_ingest/processor/grok` ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689)) ### Removed diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index 0ae9e8db3..6c5b04e77 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -2338,3 +2338,42 @@ components: type: string enum: - index_or_alias + ResourceStats: + type: object + properties: + average: + $ref: '#/components/schemas/ResourceStat' + total: + $ref: '#/components/schemas/ResourceStat' + min: + $ref: '#/components/schemas/ResourceStat' + max: + $ref: '#/components/schemas/ResourceStat' + thread_info: + $ref: '#/components/schemas/ThreadInfo' + required: + - average + - max + - min + - thread_info + - total + ResourceStat: + type: object + properties: + cpu_time_in_nanos: + $ref: '#/components/schemas/DurationValueUnitNanos' + memory_in_bytes: + $ref: '#/components/schemas/ByteCount' + required: + - cpu_time_in_nanos + - memory_in_bytes + ThreadInfo: + type: object + properties: + thread_executions: + type: number + active_threads: + type: number + required: + - active_threads + - thread_executions \ No newline at end of file diff --git a/spec/schemas/tasks._common.yaml b/spec/schemas/tasks._common.yaml index 55502dfeb..7c1652589 100644 --- a/spec/schemas/tasks._common.yaml +++ b/spec/schemas/tasks._common.yaml @@ -67,6 +67,8 @@ components: type: string parent_task_id: $ref: '_common.yaml#/components/schemas/TaskId' + resource_stats: + $ref: '_common.yaml#/components/schemas/ResourceStats' required: - action - cancellable diff --git a/tests/default/indices/delete_by_query/rethrottle.yaml b/tests/default/indices/delete_by_query/rethrottle.yaml new file mode 100644 index 000000000..17507b0c3 --- /dev/null +++ b/tests/default/indices/delete_by_query/rethrottle.yaml @@ -0,0 +1,40 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test adjusting the value of `requests_per_second` of a running delete by query. +epilogues: + - path: /books + method: DELETE + status: [200, 404] +prologues: + - path: /_bulk + method: POST + parameters: + refresh: true + request: + content_type: application/x-ndjson + payload: + - {create: {_index: books, _id: book_1392214}} + - {author: Harper Lee, title: To Kill a Mockingbird, year: 60} + - {create: {_index: books, _id: book_1392215}} + - {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 91} + - path: /books/_delete_by_query + id: task + method: POST + parameters: + wait_for_completion: false + requests_per_second: 1 + request: + payload: + query: + match_all: {} + output: + task_id: payload.task +chapters: + - synopsis: Change the value of `requests_per_second``on a running delete by query. + path: /_delete_by_query/{task_id}/_rethrottle + method: POST + parameters: + task_id: ${task.task_id} + requests_per_second: 2 + response: + status: 200