File: actions.asciidoc

package info (click to toggle)
elasticsearch-curator 4.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,288 kB
  • ctags: 1,146
  • sloc: python: 10,605; sh: 332; makefile: 163
file content (704 lines) | stat: -rw-r--r-- 21,062 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
[[actions]]
= Actions

[partintro]
--

Actions are the tasks which Curator can perform on your indices.  Snapshots,
once created, can only be deleted.

* <<alias,Alias>>
* <<allocation,Allocation>>
* <<close,Close>>
* <<cluster_routing,Cluster Routing>>
* <<create_index,Create Index>>
* <<delete_indices,Delete Indices>>
* <<delete_snapshots,Delete Snapshots>>
* <<open,Open>>
* <<forcemerge,forceMerge>>
* <<replicas,Replicas>>
* <<restore,Restore>>
* <<snapshot,Snapshot>>
--

[[alias]]
== Alias

[source,yaml]
-------------
action: alias
description: "Add/Remove selected indices to or from the specified alias"
options:
  name: alias_name
  extra_settings:
  timeout_override:
  continue_if_exception: False
  disable_action: False
add:
  filters:
  - filtertype: ...
remove:
  filters:
  - filtertype: ...
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action adds and/or removes indices from the alias identified by
 <<option_name,name>>

The <<filters,filters>> under the `add` and `remove` directives define which
indices will be added and/or removed.  This is an atomic action, so adds and
removes happen instantaneously.

The <<option_extra_settings,extra_settings>> option allows the addition of extra
settings with the `add` directive.  These settings are ignored for `remove`.  An
example of how these settings can be used to create a filtered alias might be:

[source,yaml]
-------------
extra_settings:
  filter:
    term:
      user: kimchy
-------------

WARNING: Before creating a filtered alias, first ensure that the fields already
  exist in the mapping.

Learn more about adding filtering and routing to aliases in the
{ref}/indices-aliases.html[Elasticsearch Alias API documentation].

[float]
Required settings
~~~~~~~~~~~~~~~~~

* <<option_name,name>> (required)

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_extra_settings,extra_settings>> (No default value.)
* <<option_ignore_empty,ignore_empty_list>> (can override the default)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_alias,here>>.

[[allocation]]
== Allocation

[source,yaml]
-------------
action: allocation
description: "Apply shard allocation filtering rules to the specified indices"
options:
  key:
  value:
  allocation_type:
  wait_for_completion: False
  timeout_override:
  continue_if_exception: False
  disable_action: False
filters:
- filtertype: ...
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action changes the shard routing allocation for the selected indices.

See https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-allocation-filtering.html
for more information.

You can optionally set `wait_for_completion` to `True`
to have Curator wait for the shard routing to complete before continuing.  If
this option is chosen, it is advisable to use the
<<option_timeout_override,timeout_override>> option in order to avoid client
timeouts.

[float]
Required settings
~~~~~~~~~~~~~~~~~

* <<option_key,key>> (required)
* <<option_value,value>> (required)

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_allocation_type,allocation_type>> (has a default value which can
    optionally be changed)
* <<option_wfc,wait_for_completion>> (has a default value which can optionally
    be changed)
* <<option_ignore_empty,ignore_empty_list>> (can override the default)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_allocation,here>>.

[[close]]
== Close

[source,yaml]
-------------
action: close
description: "Close selected indices"
options:
  delete_aliases: False
  timeout_override:
  continue_if_exception: False
  disable_action: False
filters:
- filtertype: ...
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action closes the selected indices, and optionally deletes associated
aliases beforehand.

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_delete_aliases,delete_aliases>> (has a default value which can
    optionally be changed)
* <<option_ignore_empty,ignore_empty_list>> (can override the default)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_close,here>>.

[[cluster_routing]]
== Cluster Routing

[source,yaml]
-------------
action: cluster_routing
description: "Apply routing rules to the entire cluster"
options:
  routing_type:
  value:
  setting: enable
  wait_for_completion: False
  timeout_override:
  continue_if_exception: False
  disable_action: False
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action changes the shard routing allocation for the selected indices.

See https://www.elastic.co/guide/en/elasticsearch/reference/current/shards-allocation.html
for more information.

You can optionally set `wait_for_completion` to `True`
to have Curator wait for the shard routing to complete before continuing.  If
this option is chosen, it is advisable to use the
<<option_timeout_override,timeout_override>> option in order to avoid client
timeouts.

[float]
Required settings
~~~~~~~~~~~~~~~~~

* <<option_routing_type,routing_type>> (required)
* <<option_value,value>> (required)
* <<option_setting,setting>> Currently must be set to `enable`.  This setting
  is a placeholder for potential future expansion.

[float]
Optional settings
~~~~~~~~~~~~~~~~~

* <<option_wfc,wait_for_completion>> (has a default value which can optionally
    be changed)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_cluster_routing,here>>.

[[create_index]]
== Create Index

[source,yaml]
-------------
action: create_index
description: "Create index as named"
options:
  name:
  extra_settings:
  timeout_override:
  continue_if_exception: False
  disable_action: False
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action creates the named index.

The <<option_extra_settings,extra_settings>> option allows the addition of extra
settings, such as index settings and mappings.  An example of how these settings
can be used to create an index might be:

[source,yaml]
-------------
extra_settings:
  settings:
    number_of_shards: 1
    number_of_replicas: 0
  mappings:
    type1 :
      properties:
        field1:
          type: string
          index: not_analyzed
-------------

[float]
Required settings
~~~~~~~~~~~~~~~~~
* <<option_name,name>>

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_extra_settings,extra_settings>> No default value.  You can add any
    acceptable index settings and mappings as nested YAML.  See the
    {ref}/indices-create-index.html[Elasticsearch Create Index API documentation]
    for more information.
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_create_index,here>>.

[[delete_indices]]
== Delete Indices

[source,yaml]
-------------
action: delete_indices
description: "Delete selected indices"
options:
  timeout_override:
  continue_if_exception: False
  disable_action: False
filters:
- filtertype: ...
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action deletes the selected indices.

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_ignore_empty,ignore_empty_list>> (can override the default)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_delete_indices,here>>.


[[delete_snapshots]]
== Delete Snapshots

[source,yaml]
-------------
action: delete_snapshots
description: "Delete selected snapshots from 'repository'"
options:
  repository:
  retry_interval:
  retry_count:
  timeout_override:
  continue_if_exception: False
  disable_action: False
filters:
- filtertype: ...
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action deletes the selected snapshots from the selected
<<option_repository,repository>>.  If issues are encountered, it will retry
up to <<option_retry_count,retry_count>> times, with a delay of
<<option_retry_interval,retry_interval>> seconds between retries.

[float]
Required settings
~~~~~~~~~~~~~~~~~

* <<option_repository,repository>> (required)

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_retry_interval,retry_interval>> (has a default value which can
    optionally be changed)
* <<option_retry_count,retry_count>> (has a default value which can optionally
    be changed)
* <<option_ignore_empty,ignore_empty_list>> (can override the default)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_delete_snapshots,here>>.


[[open]]
== Open

[source,yaml]
-------------
action: open
description: "open selected indices"
options:
  timeout_override:
  continue_if_exception: False
  disable_action: False
filters:
- filtertype: ...
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action opens the selected indices.

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_ignore_empty,ignore_empty_list>> (can override the default)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_open,here>>.


[[forcemerge]]
== Forcemerge

[source,yaml]
-------------
action: forcemerge
description: "Perform a forceMerge on selected indices to 'max_num_segments' per shard"
options:
  max_num_segments:
  delay:
  timeout_override:
  continue_if_exception: False
  disable_action: False
filters:
- filtertype: ...
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action performs a forceMerge on the selected indices, merging them to
<<option_mns,max_num_segments>> per shard, with an optional pause between each
merge of <<option_delay,delay>> seconds to allow the cluster to quiesce.

[float]
Required settings
~~~~~~~~~~~~~~~~~

* <<option_mns,max_num_segments>> (required)

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_delay,delay>> (has a default value which can optionally be changed)
* <<option_ignore_empty,ignore_empty_list>> (can override the default)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_forcemerge,here>>.



[[replicas]]
== Replicas

[source,yaml]
-------------
action: replicas
description: >- Set the number of replicas per shard for selected
    indices to 'count'
options:
  count:
  wait_for_completion: False
  timeout_override:
  continue_if_exception: False
  disable_action: False
filters:
- filtertype: ...
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action will set the number of replicas per shard to the value of
<<option_count,count>>.  You can optionally set `wait_for_completion` to `True`
to have Curator wait for the replication operation to complete before
continuing.  If this option is chosen, it is advisable to use the
<<option_timeout_override,timeout_override>> option in order to avoid client
timeouts.

[float]
Required settings
~~~~~~~~~~~~~~~~~

* <<option_count,count>> (required)

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_wfc,wait_for_completion>> (has a default value which can optionally
    be changed)
* <<option_ignore_empty,ignore_empty_list>> (can override the default)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_replicas,here>>.

[[restore]]
== Restore

[source,yaml]
-------------
actions:
  1:
    action: restore
    description: >-
      Restore all indices in the most recent snapshot with state SUCCESS.  Wait
      for the restore to complete before continuing.  Do not skip the repository
      filesystem access check.  Use the other options to define the index/shard
      settings for the restore.
    options:
      repository:
      # Leaving name blank will result in restoring the most recent snapshot by age
      name:
      # Leaving indices blank will result in restoring all indices in the snapshot
      indices:
      include_aliases: False
      ignore_unavailable: False
      include_global_state: True
      partial: False
      rename_pattern:
      rename_replacement:
      extra_settings:
      wait_for_completion: True
      skip_repo_fs_check: False
      timeout_override:
      continue_if_exception: False
      disable_action: False
    filters:
    - filtertype: state
      state: SUCCESS
      exclude:
    - filtertype: ...
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action will restore indices from the indicated
<<option_repository,repository>>, from the most recent snapshot identified by
the applied filters, or the snapshot identified by <<option_name,name>>.

The other options are usually okay to leave at the defaults, but feel free to
read about them and change them accordingly.

The <<option_extra_settings,extra_settings>> option allows the addition of extra
settings, such as index settings and mappings.  An example of how these settings
can be used to change settings for an index being restored might be:

[source,yaml]
-------------
extra_settings:
  settings:
    number_of_shards: 1
    number_of_replicas: 0
  mappings:
    type1 :
      properties:
        field1:
          type: string
          index: not_analyzed
-------------

[float]
Required settings
~~~~~~~~~~~~~~~~~

* <<option_repository,repository>> (required)

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_name,name>> (has no default value)
* <<option_include_aliases,include_aliases>> (has a default value which can
    optionally be changed)
* <<option_indices,indices>> (has a default value which can optionally be
    changed)
* <<option_ignore,ignore_unavailable>> (has a default value which can optionally
    be changed)
* <<option_include_gs,include_global_state>> (has a default value which can
    optionally be changed)
* <<option_partial,partial>> (has a default value which can optionally be
    changed)
* <<option_rename_pattern,rename_pattern>> (has no default value)
* <<option_rename_replacement,rename_replacement>> (has no default value)
* <<option_extra_settings,extra_settings>> (has no default value.)
* <<option_wfc,wait_for_completion>> (has a default value which can optionally
    be changed)
* <<option_skip_fsck,skip_repo_fs_check>> (has a default value which can
    optionally be changed)
* <<option_ignore_empty,ignore_empty_list>> (can override the default)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_restore,here>>.

[[snapshot]]
== Snapshot

[source,yaml]
-------------
action: snapshot
description: >-
  Snapshot selected indices to 'repository' with the snapshot name or name
  pattern in 'name'.  Use all other options as assigned
options:
  repository:
  # Leaving name blank will result in the default 'curator-%Y%m%d%H%M%S'
  name:
  ignore_unavailable: False
  include_global_state: True
  partial: False
  wait_for_completion: True
  skip_repo_fs_check: False
  timeout_override:
  continue_if_exception: False
  disable_action: False
filters:
- filtertype: ...
-------------

NOTE: Empty values and commented lines will result in the default value, if any,
    being selected.  If a setting is set, but not used by a given action, it
    will be ignored.

This action will snapshot indices to the indicated
<<option_repository,repository>>, with a name, or name pattern, as identified by
<<option_name,name>>.

The other options are usually okay to leave at the defaults, but feel free to
read about them and change them accordingly.

[float]
Required settings
~~~~~~~~~~~~~~~~~

* <<option_repository,repository>> (required)

[float]
Optional settings
~~~~~~~~~~~~~~~~~
* <<option_name,name>> (has a default value which can optionally be changed)
* <<option_ignore,ignore_unavailable>> (has a default value which can optionally
    be changed)
* <<option_include_gs,include_global_state>> (has a default value which can
    optionally be changed)
* <<option_partial,partial>> (has a default value which can optionally be
    changed)
* <<option_wfc,wait_for_completion>> (has a default value which can optionally
    be changed)
* <<option_skip_fsck,skip_repo_fs_check>> (has a default value which can
    optionally be changed)
* <<option_ignore_empty,ignore_empty_list>> (can override the default)
* <<option_timeout_override,timeout_override>> (can override the default
    <<timeout,timeout>>)
* <<option_continue,continue_if_exception>> (has a default value which can
    optionally be changed)
* <<option_disable,disable_action>> (has a default value which can optionally
    be changed)

TIP: See an example of this action in an <<actionfile,actionfile>>
    <<ex_snapshot,here>>.