Skip to content

Commit

Permalink
Added missing types for /_delete_by_query/{task_id}/_rethrottle. (ope…
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock authored Nov 25, 2024
1 parent c51aa2e commit 4615564
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions spec/schemas/tasks._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions tests/default/indices/delete_by_query/rethrottle.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4615564

Please sign in to comment.