Action Classes¶
See also
It is important to note that each action has a do_action() method, which accepts no arguments. This is the means by which all actions are executed.
Alias¶
-
class
curator.actions.
Alias
(name=None, extra_settings={})¶ Define the Alias object.
Parameters: - name – The alias name
- extra_settings (dict, representing the settings.) – Extra settings, including filters and routing. For more information see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
-
actions
= None¶ The list of actions to perform. Populated by
curator.actions.Alias.add
andcurator.actions.Alias.remove
-
add
(ilo)¶ Create add statements for each index in ilo for alias, then append them to actions. Add any extras that may be there.
Parameters: ilo – A curator.indexlist.IndexList
object
-
body
()¶ Return a body string suitable for use with the update_aliases API call.
-
client
= None¶ Instance variable. The Elasticsearch Client object derived from ilo
-
do_action
()¶ Run the API call update_aliases with the results of body()
-
do_dry_run
()¶ Log what the output would be, but take no action.
-
extra_settings
= None¶ Instance variable. Any extra things to add to the alias, like filters, or routing.
-
name
= None¶ Instance variable The strftime parsed version of name.
-
remove
(ilo)¶ Create remove statements for each index in ilo for alias, then append them to actions.
Parameters: ilo – A curator.indexlist.IndexList
object
Allocation¶
-
class
curator.actions.
Allocation
(ilo, key=None, value=None, allocation_type='require', wait_for_completion=False, timeout=30)¶ Parameters: - ilo – A
curator.indexlist.IndexList
object - key – An arbitrary metadata attribute key. Must match the key assigned to at least some of your nodes to have any effect.
- value – An arbitrary metadata attribute value. Must correspond to values associated with key assigned to at least some of your nodes to have any effect.
- allocation_type – Type of allocation to apply. Default is require
- wait_for_completion (bool) – Wait (or not) for the operation to complete before returning. (default: False)
- timeout – Number of seconds to wait_for_completion
Note
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-allocation-filtering.html
-
bkey
= None¶ Instance variable. Populated at instance creation time. Value is
index.routing.allocation.
allocation_type.
key.
value
-
client
= None¶ Instance variable. The Elasticsearch Client object derived from ilo
-
do_action
()¶ Change allocation settings for indices in index_list.indices with the settings in body.
-
do_dry_run
()¶ Log what the output would be, but take no action.
-
index_list
= None¶ Instance variable. Internal reference to ilo
-
timeout
= None¶ Instance variable. How long in seconds to wait_for_completion before returning with an exception
-
wfc
= None¶ Instance variable. Internal reference to wait_for_completion
- ilo – A
Close¶
-
class
curator.actions.
Close
(ilo, delete_aliases=False)¶ Parameters: - ilo – A
curator.indexlist.IndexList
object - delete_aliases (bool) – If True, will delete any associated aliases before closing indices.
-
client
= None¶ Instance variable. The Elasticsearch Client object derived from ilo
-
delete_aliases
= None¶ Instance variable. Internal reference to delete_aliases
-
do_action
()¶ Close open indices in index_list.indices
-
do_dry_run
()¶ Log what the output would be, but take no action.
-
index_list
= None¶ Instance variable. Internal reference to ilo
- ilo – A
DeleteIndices¶
-
class
curator.actions.
DeleteIndices
(ilo, master_timeout=30)¶ Parameters: - ilo – A
curator.indexlist.IndexList
object - master_timeout – Number of seconds to wait for master node response
-
client
= None¶ Instance variable. The Elasticsearch Client object derived from ilo
-
do_action
()¶ Delete indices in index_list.indices
-
do_dry_run
()¶ Log what the output would be, but take no action.
-
index_list
= None¶ Instance variable. Internal reference to ilo
-
master_timeout
= None¶ Instance variable. String value of master_timeout + ‘s’, for seconds.
- ilo – A
DeleteSnapshots¶
-
class
curator.actions.
DeleteSnapshots
(slo, retry_interval=120, retry_count=3)¶ Parameters: - slo – A
curator.snapshotlist.SnapshotList
object - retry_interval – Number of seconds to delay betwen retries. Default: 120 (seconds)
- retry_count – Number of attempts to make. Default: 3
-
client
= None¶ Instance variable. The Elasticsearch Client object derived from slo
-
do_action
()¶ Delete snapshots in slo Retry up to retry_count times, pausing retry_interval seconds between retries.
-
do_dry_run
()¶ Log what the output would be, but take no action.
-
repository
= None¶ Instance variable. The repository name derived from slo
-
retry_count
= None¶ Instance variable. Internally accessible copy of retry_count
-
retry_interval
= None¶ Instance variable. Internally accessible copy of retry_interval
-
snapshot_list
= None¶ Instance variable. Internal reference to slo
- slo – A
ForceMerge¶
-
class
curator.actions.
ForceMerge
(ilo, max_num_segments=None, delay=0)¶ Parameters: - ilo – A
curator.indexlist.IndexList
object - max_num_segments – Number of segments per shard to forceMerge
- delay – Number of seconds to delay between forceMerge operations
-
client
= None¶ Instance variable. The Elasticsearch Client object derived from ilo
-
delay
= None¶ Instance variable. Internally accessible copy of delay
-
do_action
()¶ forcemerge indices in index_list.indices
-
do_dry_run
()¶ Log what the output would be, but take no action.
-
index_list
= None¶ Instance variable. Internal reference to ilo
-
max_num_segments
= None¶ Instance variable. Internally accessible copy of max_num_segments
- ilo – A
Open¶
-
class
curator.actions.
Open
(ilo)¶ Parameters: ilo – A curator.indexlist.IndexList
object-
client
= None¶ Instance variable. The Elasticsearch Client object derived from ilo
-
do_action
()¶ Open closed indices in index_list.indices
-
do_dry_run
()¶ Log what the output would be, but take no action.
-
index_list
= None¶ Instance variable. Internal reference to ilo
-
Replicas¶
-
class
curator.actions.
Replicas
(ilo, count=None, wait_for_completion=False, timeout=30)¶ Parameters: - ilo – A
curator.indexlist.IndexList
object - count – The count of replicas per shard
- wait_for_completion (bool) – Wait (or not) for the operation to complete before returning. (default: False)
-
client
= None¶ Instance variable. The Elasticsearch Client object derived from ilo
-
count
= None¶ Instance variable. Internally accessible copy of count
-
do_action
()¶ Update the replica count of indices in index_list.indices
-
do_dry_run
()¶ Log what the output would be, but take no action.
-
index_list
= None¶ Instance variable. Internal reference to ilo
-
timeout
= None¶ Instance variable. How long in seconds to wait_for_completion before returning with an exception
-
wfc
= None¶ Instance variable. Internal reference to wait_for_completion
- ilo – A
Snapshot¶
-
class
curator.actions.
Snapshot
(ilo, repository=None, name=None, ignore_unavailable=False, include_global_state=True, partial=False, wait_for_completion=True, skip_repo_fs_check=False)¶ Parameters: - ilo – A
curator.indexlist.IndexList
object - repository – The Elasticsearch snapshot repository to use
- name – What to name the snapshot.
- wait_for_completion (bool) – Wait (or not) for the operation to complete before returning. (default: True)
- ignore_unavailable (bool) – Ignore unavailable shards/indices. (default: False)
- include_global_state (bool) – Store cluster global state with snapshot. (default: True)
- partial (bool) – Do not fail if primary shard is unavailable. (default: False)
- skip_repo_fs_check (bool) – Do not validate write access to repository on all cluster nodes before proceeding. (default: False). Useful for shared filesystems where intermittent timeouts can affect validation, but won’t likely affect snapshot success.
-
body
= None¶ Instance variable. Populated at instance creation time by calling
curator.utils.create_snapshot_body
with ilo.indices and the provided arguments: ignore_unavailable, include_global_state, partial
-
client
= None¶ Instance variable. The Elasticsearch Client object derived from ilo
-
do_action
()¶ Snapshot indices in index_list.indices, with options passed.
-
do_dry_run
()¶ Log what the output would be, but take no action.
-
get_state
()¶ Get the state of the snapshot
-
index_list
= None¶ Instance variable. Internal reference to ilo
-
name
= None¶ Instance variable. The parsed version of name
-
report_state
()¶ Log the state of the snapshot
-
repository
= None¶ Instance variable. Internally accessible copy of repository
-
skip_repo_fs_check
= None¶ Instance variable. Internally accessible copy of skip_repo_fs_check
-
wait_for_completion
= None¶ Instance variable. Internally accessible copy of wait_for_completion
- ilo – A
Restore¶
-
class
curator.actions.
Restore
(slo, name=None, indices=None, include_aliases=False, ignore_unavailable=False, include_global_state=True, partial=False, rename_pattern=None, rename_replacement=None, extra_settings={}, wait_for_completion=True, skip_repo_fs_check=False)¶ Parameters: - slo – A
curator.snapshotlist.SnapshotList
object - name (str) – Name of the snapshot to restore. If no name is provided, it will restore the most recent snapshot by age.
- indices (list) – A list of indices to restore. If no indices are provided, it will restore all indices in the snapshot.
- include_aliases (bool) – If set to True, restore aliases with the indices. (default: False)
- ignore_unavailable (bool) – Ignore unavailable shards/indices. (default: False)
- include_global_state (bool) – Store cluster global state with snapshot. (default: True)
- partial (bool) – Do not fail if primary shard is unavailable. (default: False)
- rename_pattern (str) – A regular expression pattern with one or more
captures, e.g.
index_(.+)
- rename_replacement (str) – A target index name pattern with $# numbered
references to the captures in
rename_pattern
, e.g.restored_index_$1
- extra_settings (dict, representing the settings.) – Extra settings, including shard count and settings to omit. For more information see https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html#_changing_index_settings_during_restore
- wait_for_completion (bool) – Wait (or not) for the operation to complete before returning. (default: True)
- skip_repo_fs_check (bool) – Do not validate write access to repository on all cluster nodes before proceeding. (default: False). Useful for shared filesystems where intermittent timeouts can affect validation, but won’t likely affect snapshot success.
-
body
= None¶ Instance variable. Populated at instance creation time from the other options
-
client
= None¶ Instance variable. The Elasticsearch Client object derived from slo
-
do_action
()¶ Restore indices with options passed.
-
do_dry_run
()¶ Log what the output would be, but take no action.
-
name
= None¶ Instance variable. Will use a provided snapshot name, or the most recent snapshot in slo
-
py_rename_replacement
= None¶ Also an instance variable version of
rename_replacement
but with Java regex group designations of$#
converted to Python’s\\#
style.
-
rename_pattern
= None¶ Instance variable version of
rename_pattern
-
rename_replacement
= None¶ Instance variable version of
rename_replacement
-
report_state
()¶ Log the state of the restore This should only be done if
wait_for_completion
is True, and only after completing the restore.
-
repository
= None¶ Instance variable. repository derived from slo
-
skip_repo_fs_check
= None¶ Instance variable. Internally accessible copy of skip_repo_fs_check
-
snapshot_list
= None¶ Instance variable. Internal reference to slo
- slo – A