Non-Iterative Methods

Managing Aliases

static curator.add_to_alias(client, index_name, alias=None, **kwargs)

Add indicated index to the specified alias.

Parameters:
  • client – The Elasticsearch client connection
  • index_name – The index name
  • alias – Alias name to operate on.
Return type:

bool

static curator.remove_from_alias(client, index_name, alias=None, **kwargs)

Remove the indicated index from the specified alias.

Parameters:
  • client – The Elasticsearch client connection
  • index_name – The index name
  • alias – Alias name to operate on.
Return type:

bool

Shard-Awareness Allocation Rules

static curator.apply_allocation_rule(client, index_name, rule=None, **kwargs)

Apply a required allocation rule to an index. See: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-allocation.html#index-modules-allocation

Parameters:
  • client – The Elasticsearch client connection
  • index_name – The index name
  • rule – The routing allocation rule to apply, e.g. tag=ssd. Must be in the format of key=value, and should match values declared on the correlating nodes in your cluster.

Disable Bloom Filter Cache

static curator.disable_bloom_filter(client, index_name, **kwargs)

Disable the bloom filter cache for the specified index.

Parameters:
  • client – The Elasticsearch client connection
  • index_name – The index name

Change Replica Count of Indices

static curator.change_replicas(client, index_name, replicas=None, **kwargs)

Change the number of replicas, more or less, for the indicated index.

Parameters:
  • client – The Elasticsearch client connection
  • index_name – The index name
  • replicas – The number of replicas the index should have

Close Indices

static curator.close_index(client, index_name, **kwargs)

Close the indicated index. Flush before closing.

Parameters:
  • client – The Elasticsearch client connection
  • index_name – The index name

Delete Indices

static curator.delete_index(client, index_name, **kwargs)

Delete the indicated index.

Parameters:
  • client – The Elasticsearch client connection
  • index_name – The index name

Optimize Indices

static curator.optimize_index(client, index_name, max_num_segments=2, **kwargs)

Optimize (Lucene forceMerge) index to max_num_segments per shard

Parameters:
  • client – The Elasticsearch client connection
  • index_name – The index name
  • max_num_segments – Merge to this number of segments per shard.

Snapshot Indices

static curator.create_snapshot(client, indices='_all', snapshot_name=None, snapshot_prefix='curator-', repository='', ignore_unavailable=False, include_global_state=True, partial=False, wait_for_completion=True, **kwargs)

Create a snapshot of provided indices (or _all) that are open.

Parameters:
  • client – The Elasticsearch client connection
  • indices – A list of indices to snapshot. Default is _all
  • snapshot_name – What to name the snapshot. snapshot_prefix + datestamp if omitted.
  • snapshot_prefix – Override the default with this value. Defaults to curator-
  • repository – The Elasticsearch snapshot repository to use
  • wait_for_completion (bool) – Wait (or not) for the operation to complete before returning. Waits by default, i.e. Default is True
  • ignore_unavailable (bool) – Ignore unavailable shards/indices. Default is False
  • include_global_state (bool) – Store cluster global state with snapshot. Default is True
  • partial (bool) – Do not fail if primary shard is unavailable. Default is False
static curator.create_snapshot_body(indices, ignore_unavailable=False, include_global_state=True, partial=False, **kwargs)

Create the request body for creating a snapshot from the provided arguments.

Parameters:
  • indices – A single index, or list of indices to snapshot.
  • ignore_unavailable – Boolean. Ignore unavailable shards/indices. Default is False
  • include_global_state – Boolean. Store cluster global state with snapshot. Default is True
  • partial – Boolean. Do not fail if primary shard is unavailable. Default is False
static curator.delete_snapshot(client, snap, **kwargs)

Delete a snapshot (or comma-separated list of snapshots)

Parameters:
  • client – The Elasticsearch client connection
  • snap – The snapshot name
  • repository – The Elasticsearch snapshot repository to use