Difference between revisions of "Opensearch-cli curl get --help"

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

Latest revision as of 11:33, 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[edit]

Advertising: