Difference between revisions of "Opensearch-cli curl get"

From wikieduonline
Jump to navigation Jump to search
(Created page with "{{lc}} == See also == * {{opensearch-cli}} Category:OpenSearch")
 
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
  
 +
<pre>
 +
opensearch-cli curl get --help
 +
Get command enables you to run any GET API against cluster
 +
 +
Usage:
 +
  opensearch-cli curl get [flags]
 +
 +
Examples:
 +
 +
# get document count for an index
 +
opensearch-cli curl get --path "_cat/count/my-index-01" --query-params "v=true" --pretty
 +
 +
# get health status of a cluster.
 +
opensearch-cli curl get --path "_cluster/health" --pretty --filter-path "status"
 +
 +
# get explanation for cluster allocation for a given index and shard number
 +
opensearch-cli curl get --path "_cluster/allocation/explain" \
 +
                  --data '{
 +
                    "index": "my-index-01",
 +
                    "shard": 0,
 +
                    "primary": false,
 +
                    "current_node": "nodeA"
 +
                  }'
 +
 +
 +
Flags:
 +
  -d, --data string          Data for the REST API. If value starts with '@', the rest should be a file name to read the data from.
 +
  -H, --headers :            Headers for the REST API. Consists of case-insensitive name followed by a colon (:), then by its value. Use ';' to separate multiple parameters. Ex: -H "content-type:json;accept-encoding:gzip"
 +
  -h, --help                  Help for curl get
 +
  -P, --path string          URL path for the REST API
 +
  -q, --query-params string  URL query parameters (key & value) for the REST API. Use ‘&’ to separate multiple parameters. Ex: -q "v=true&s=order:desc,index_patterns"
 +
 +
Global Flags:
 +
  -c, --config string          Configuration file for opensearch-cli, default is /Users/sf/.opensearch-cli/config.yaml
 +
  -f, --filter-path string    Filter output fields returned by OpenSearch. Use comma ',' to separate list of filters
 +
  -o, --output-format string  Output format if supported by cluster, else, default format by OpenSearch. Example json, yaml
 +
      --pretty                Response will be formatted
 +
  -p, --profile string        Use a specific profile from your configuration file
 +
</pre>
  
  

Revision as of 11:31, 22 April 2022

opensearch-cli curl get --help
Get command enables you to run any GET API against cluster

Usage:
  opensearch-cli curl get [flags]

Examples:

# get document count for an index
opensearch-cli curl get --path "_cat/count/my-index-01" --query-params "v=true" --pretty

# get health status of a cluster.
opensearch-cli curl get --path "_cluster/health" --pretty --filter-path "status"

# get explanation for cluster allocation for a given index and shard number
opensearch-cli curl get --path "_cluster/allocation/explain" \
                  --data '{
                    "index": "my-index-01",
                    "shard": 0,
                    "primary": false,
                    "current_node": "nodeA"
                  }'


Flags:
  -d, --data string           Data for the REST API. If value starts with '@', the rest should be a file name to read the data from.
  -H, --headers :             Headers for the REST API. Consists of case-insensitive name followed by a colon (:), then by its value. Use ';' to separate multiple parameters. Ex: -H "content-type:json;accept-encoding:gzip"
  -h, --help                  Help for curl get
  -P, --path string           URL path for the REST API
  -q, --query-params string   URL query parameters (key & value) for the REST API. Use ‘&’ to separate multiple parameters. Ex: -q "v=true&s=order:desc,index_patterns"

Global Flags:
  -c, --config string          Configuration file for opensearch-cli, default is /Users/sf/.opensearch-cli/config.yaml
  -f, --filter-path string     Filter output fields returned by OpenSearch. Use comma ',' to separate list of filters
  -o, --output-format string   Output format if supported by cluster, else, default format by OpenSearch. Example json, yaml
      --pretty                 Response will be formatted
  -p, --profile string         Use a specific profile from your configuration file


See also

Advertising: