[[command-line]]
== The Command-Line Interface

=== Structure

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

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

&nbsp;

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,commands>> and <<flags,flags>> for more
information.

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

-------
curator --help

curator COMMAND --help

curator COMMAND SUBCOMMAND --help
-------

&nbsp;

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)
-------

&nbsp;

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

=== Non-destructive Exploration

The <<show>> command will only ever show indices or snapshots matching the
<<index-selection,index selection>> or <<snapshot-selection,snapshot selection>>
parameters you provide.  The <<dry-run,--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,selection>> criteria without fear of making a mistake.
