The Command-Line Interfaceedit

Structureedit

Curator commands can be thought of as a series of nested commands, with each stage having its own options and flags.

curator [FLAGS] COMMAND [FLAGS] SUBCOMMAND [FLAGS]

 

The square braces indicate optional elements. Some commands have flags, some do not. Some of those flags are optional, some are mandatory per the command. See the list of commands and flags for more information.

The first thing to know is that help is never far away. You can use the --help flag at any stage to discover which flags are available:

curator --help

curator COMMAND --help

curator COMMAND SUBCOMMAND --help

 

Understand that using the --help flag in between two nested commands will result in the previous level --help output being shown.

curator --help COMMAND will have the same output as curator --help, and likewise, curator COMMAND --help SUBCOMMAND will have the same output as curator COMMAND --help.

The top-level help output looks like this:

$ curator --help
Usage: curator [OPTIONS] COMMAND [ARGS]...

  Curator for Elasticsearch indices.

  See http://elastic.co/guide/en/elasticsearch/client/curator/current


Options:
  --host TEXT        Elasticsearch host.
  --url_prefix TEXT  Elasticsearch http url prefix.
  --port INTEGER     Elasticsearch port.
  --use_ssl          Connect to Elasticsearch through SSL.
  --http_auth TEXT   Use Basic Authentication ex: user:pass
  --timeout INTEGER  Connection timeout in seconds.
  --master-only      Only operate on elected master node.
  --dry-run          Do not perform any changes.
  --debug            Debug mode
  --loglevel TEXT    Log level
  --logfile TEXT     log file
  --logformat TEXT   Log output format [default|logstash].
  --version          Show the version and exit.
  --help             Show this message and exit.

Commands:
  alias       Index Aliasing
  allocation  Index Allocation
  bloom       Disable bloom filter cache
  close       Close indices
  delete      Delete indices or snapshots
  open        Open indices
  optimize    Optimize Indices
  replicas    Replica Count Per-shard
  show        Show indices or snapshots
  snapshot    Take snapshots of indices (Backup)

 

Note that all available flags and commands for this level are shown. This pattern is repeated at each successive level of --help

Non-destructive Explorationedit

The show command will only ever show indices or snapshots matching the index selection or snapshot selection parameters you provide. The --dry-run flag will also show which indices or snapshots would have been acted on, but not perform the action.

With these two options, you can explore your indices and work on building a set of selection criteria without fear of making a mistake.