-
Notifications
You must be signed in to change notification settings - Fork 105
Add Cluster/Allocation/Explain Query Param Example #4849
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -25,6 +25,7 @@ import { Duration } from '@_types/Time' | |||||
/** | ||||||
* Explain the shard allocations. | ||||||
* Get explanations for shard allocations in the cluster. | ||||||
* This API accepts the current_node, index, primary and shard parameters via the request body, or via query parameters, but not via both at the same time. | ||||||
* For unassigned shards, it provides an explanation for why the shard is unassigned. | ||||||
* For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. | ||||||
* This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. | ||||||
|
@@ -44,6 +45,22 @@ export interface Request extends RequestBase { | |||||
} | ||||||
] | ||||||
query_parameters: { | ||||||
/** | ||||||
* Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this what is meant?
Suggested change
|
||||||
*/ | ||||||
current_node?: string | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we prefer using aliases rather than primitive types when possible
Suggested change
|
||||||
/** | ||||||
* Specifies the name of the index that you would like an explanation for. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
*/ | ||||||
index?: IndexName | ||||||
/** | ||||||
* If true, returns explanation for the primary shard for the given shard ID. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean that the
Suggested change
|
||||||
*/ | ||||||
primary?: boolean | ||||||
/** | ||||||
* Specifies the ID of the shard that you would like an explanation for. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Alternatively, maybe "... that you want explained". |
||||||
*/ | ||||||
shard?: integer | ||||||
/** | ||||||
* If true, returns information about disk usage and shard sizes. | ||||||
* @server_default false | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,53 @@ | ||||||
summary: Query Parameters | ||||||
method_request: GET _cluster/allocation/explain | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is incorrect, all the parameters need to be added to the method_request field for the automation to generate the examples correctly
Suggested change
|
||||||
description: > | ||||||
Run `GET _cluster/allocation/explain?index="my-index-000001"&shard=0&primary=false¤t_node="my-node` to get an explanation for a shard's current allocation. No parameters are required in the request body | ||||||
# type: request | ||||||
value: |- | ||||||
{} | ||||||
alternatives: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can delete everything below the |
||||||
- language: Python | ||||||
code: |- | ||||||
resp = client.cluster.allocation_explain( | ||||||
index="my-index-000001", | ||||||
shard=0, | ||||||
primary=False, | ||||||
current_node="my-node", | ||||||
) | ||||||
- language: JavaScript | ||||||
code: |- | ||||||
const response = await client.cluster.allocationExplain({ | ||||||
index: "my-index-000001", | ||||||
shard: 0, | ||||||
primary: false, | ||||||
current_node: "my-node", | ||||||
}); | ||||||
- language: Ruby | ||||||
code: |- | ||||||
response = client.cluster.allocation_explain( | ||||||
index: "my-index-000001", | ||||||
shard: 0, | ||||||
primary: false, | ||||||
current_node: "my-node", | ||||||
body: {} | ||||||
) | ||||||
- language: PHP | ||||||
code: |- | ||||||
$resp = $client->cluster()->allocationExplain([ | ||||||
"index" => "my-index-000001", | ||||||
"shard" => 0, | ||||||
"primary" => false, | ||||||
"current_node" => "my-node", | ||||||
"body" => [], | ||||||
]); | ||||||
- language: curl | ||||||
code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" | ||||||
"$ELASTICSEARCH_URL/_cluster/allocation/explain?index="my-index-000001"&shard=0&primary=false¤t_node="my-node"' | ||||||
- language: Java | ||||||
code: | | ||||||
client.cluster().allocationExplain(a -> a | ||||||
.currentNode("my-node") | ||||||
.index("my-index-000001") | ||||||
.primary(false) | ||||||
.shard(0) | ||||||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to avoid using the term "via"