kolchfa-aws 89f966a0f1
Refactors JS client helper documentation (#1358)
* Fix Circuit Breaker section in JS client docs

Fix #823

Signed-off-by: Robert Da Silva <mail@robdasilva.com>

* Add documentation for JS client bulk helper

Signed-off-by: Robert Da Silva <mail@robdasilva.com>

* Refactors js client helper documentation

* Incorporated tech review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Incorporated doc review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Update _clients/javascript/helpers.md

Co-authored-by: Alice Williams <88908598+alicejw-aws@users.noreply.github.com>

* Update _clients/javascript/helpers.md

Co-authored-by: Alice Williams <88908598+alicejw-aws@users.noreply.github.com>

* Update helpers.md

* Incorporated tech review feedback

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Implemented editorial comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

Signed-off-by: Robert Da Silva <mail@robdasilva.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Co-authored-by: Robert Da Silva <mail@robdasilva.com>
Co-authored-by: Alice Williams <88908598+alicejw-aws@users.noreply.github.com>
2022-10-11 12:08:28 -04:00

2.9 KiB

layout title nav_order has_children
default OpenSearch CLI 80 false

OpenSearch CLI

The OpenSearch CLI command line interface (opensearch-cli) lets you manage your OpenSearch cluster from the command line and automate tasks.

Currently, opensearch-cli supports the Anomaly Detection and k-NN plugins, along with arbitrary REST API paths. Among other things, you can use opensearch-cli to create and delete detectors, start and stop them, and check k-NN statistics.

Profiles let you easily access different clusters or sign requests with different credentials. opensearch-cli supports unauthenticated requests, HTTP basic signing, and IAM signing for Amazon Web Services.

This example moves a detector (ecommerce-count-quantity) from a staging cluster to a production cluster:

opensearch-cli ad get ecommerce-count-quantity --profile staging > ecommerce-count-quantity.json
opensearch-cli ad create ecommerce-count-quantity.json --profile production
opensearch-cli ad start ecommerce-count-quantity.json --profile production
opensearch-cli ad stop ecommerce-count-quantity --profile staging
opensearch-cli ad delete ecommerce-count-quantity --profile staging

Install

  1. Download{:target='_blank'} and extract the appropriate installation package for your computer.

  2. Make the opensearch-cli file executable:

    chmod +x ./opensearch-cli
    
  3. Add the command to your path:

    export PATH=$PATH:$(pwd)
    
  4. Confirm the CLI is working properly:

    opensearch-cli --version
    

Profiles

Profiles let you easily switch between different clusters and user credentials. To get started, run opensearch-cli profile create with the --auth-type, --endpoint, and --name options:

opensearch-cli profile create --auth-type basic --endpoint https://localhost:9200 --name docker-local

Alternatively, save a configuration file to ~/.opensearch-cli/config.yaml:

profiles:
    - name: docker-local
      endpoint: https://localhost:9200
      user: admin
      password: foobar
    - name: aws
      endpoint: https://some-cluster.us-east-1.es.amazonaws.com
      aws_iam:
        profile: ""
        service: es

Usage

opensearch-cli commands use the following syntax:

opensearch-cli <command> <subcommand> <flags>

For example, the following command retrieves information about a detector:

opensearch-cli ad get my-detector --profile docker-local

For a request to the OpenSearch CAT API, try the following command:

opensearch-cli curl get --path _cat/plugins --profile aws

Use the -h or --help flag to see all supported commands, subcommands, or usage for a specific command:

opensearch-cli -h
opensearch-cli ad -h
opensearch-cli ad get -h