Skip to content

Commit

Permalink
Merge pull request #1264 from jrask/feature_empty_filter
Browse files Browse the repository at this point in the history
Exposed filter_empty function as a filter
  • Loading branch information
untergeek committed Sep 11, 2018
2 parents c720f79 + d393cbc commit 48126f5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions curator/defaults/filtertypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,8 @@ def state(action, config):
filter_elements.state(),
filter_elements.exclude(),
]

def empty(action, config):
return [
filter_elements.exclude(),
]
1 change: 1 addition & 0 deletions curator/defaults/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def index_filtertypes():
'age',
'closed',
'count',
'empty',
'forcemerged',
'ilm',
'kibana',
Expand Down
1 change: 1 addition & 0 deletions curator/indexlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def __map_method(self, ft):
'allocated': self.filter_allocated,
'closed': self.filter_closed,
'count': self.filter_by_count,
'empty': self.filter_empty,
'forcemerged': self.filter_forceMerged,
'ilm': self.filter_ilm,
'kibana': self.filter_kibana,
Expand Down
22 changes: 22 additions & 0 deletions docs/asciidoc/filters.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The index filtertypes are:
* <<filtertype_allocated,allocated>>
* <<filtertype_closed,closed>>
* <<filtertype_count,count>>
* <<filtertype_empty,empty>>
* <<filtertype_forcemerged,forcemerged>>
* <<filtertype_kibana,kibana>>
* <<filtertype_none,none>>
Expand Down Expand Up @@ -69,6 +70,7 @@ The index filtertypes are:
* <<filtertype_allocated,allocated>>
* <<filtertype_closed,closed>>
* <<filtertype_count,count>>
* <<filtertype_empty,empty>>
* <<filtertype_forcemerged,forcemerged>>
* <<filtertype_kibana,kibana>>
* <<filtertype_none,none>>
Expand Down Expand Up @@ -441,6 +443,26 @@ removed from the actionable list, leaving `index-2017.03.03`,
* <<fe_stats_result,stats_result>> (only used if `source` is `field_stats`)


[[filtertype_empty]]
== empty
[source,yaml]
-------------
- filtertype: empty
exclude: False
-------------

This <<filtertype,filtertype>> will iterate over the actionable list and match
indices which does not contain any documents. They will remain in, or be
removed from the actionable list based on the value of <<fe_exclude,exclude>>.

By default the indices matched by the empty filter will be excluded since
the exclude setting defaults to True. To include matching indices rather than
exclude, set the exclude setting to False.

=== Optional settings

* <<fe_exclude,exclude>> (default is `True`)


[[filtertype_forcemerged]]
== forcemerged
Expand Down

0 comments on commit 48126f5

Please sign in to comment.