# Curator Alias Add not working if Remove list is empty

**URL:** <https://discuss.elastic.co/t/curator-alias-add-not-working-if-remove-list-is-empty/73549>\
**Category:** Elasticsearch\
**Created:** [February 1, 2017, 4:29pm UTC](https://discuss.elastic.co/t/curator-alias-add-not-working-if-remove-list-is-empty/73549 "2017-02-01T16:29:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![crags](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/crags/32/15112_2.png) [@crags](https://discuss.elastic.co/u/crags)\
**Post date:** [February 1, 2017, 4:29pm UTC](https://discuss.elastic.co/t/curator-alias-add-not-working-if-remove-list-is-empty/73549/1 "2017-02-01T16:29:58Z")

</div>

Hi All

I was just wondering if you could help me with something and whether this is the intended behaviour of Curator or not... I am currently setting up a number of automated alias actions in Curator, for things like "today", "yesterday", "last 7 days" etc etc and have come across an odd potential issue...

When testing my "Last 7 Days" function, it is set up as the following:

```auto
action: alias
    description: >-
      Add relevant event indexes to a "Last 7 Days" alias for rapid searching etc
    options:
      name: events_last_7
      extra_settings:
      timeout_override:
      ignore_empty_list: True
      continue_if_exception: False
      disable_action: False
    add:
      filters:
      - filtertype: pattern
        kind: prefix
        value: event-
        exclude:
      - filtertype: age
        source: name
        direction: younger
        timestring: '%Y.%m.%d'
        unit: days
        unit_count: 7
        exclude:
    remove:
      filters:
      - filtertype: pattern
        kind: prefix
        value: event-
        exclude:
      - filtertype: age
        source: name
        direction: younger
        timestring: '%Y.%m.%d'
        unit: days
        unit_count: 7
        exclude: True

```

The problem I am having is, if I comment out the `remove` section it works fine (I only have 4 indexes as I'm testing which are dated over the last 4 days) but if I put the remove section in - because there are no indexes older than 7 days, it seems to return an empty list and fail the whole action?

I would expect the `add` action to complete successfully and the `remove` one to do nothing - or does it simply see the whole lot as one `action` which fails if one element of it fails?

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [February 1, 2017, 5:07pm UTC](https://discuss.elastic.co/t/curator-alias-add-not-working-if-remove-list-is-empty/73549/2 "2017-02-01T17:07:44Z")

</div>

> [@crags](#):
>
> I would expect the `add` action to complete successfully and the `remove` one to do nothing - or does it simply see the whole lot as one `action` which fails if one element of it fails?

It is atomic. Both are processed at once, so yes, currently, if one of `add` or `remove` is present but empty, that would result in an error.

If you want them performed serially, you would need to have 2 separate actions, one with an `add`, the other with the `remove`.

In contemplating whether it is wise to treat an "empty" `add` or `remove` as an indicator to remove that action from the final atomic call, I'm not sure. I can see benefits and drawbacks to this. What are your thoughts?

---

<div class="post-metadata">

**Author:** ![crags](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/crags/32/15112_2.png) [@crags](https://discuss.elastic.co/u/crags)\
**Post date:** [February 1, 2017, 7:09pm UTC](https://discuss.elastic.co/t/curator-alias-add-not-working-if-remove-list-is-empty/73549/3 "2017-02-01T19:09:43Z")

</div>

Okay, I figured that may be the case - creating separate actions for add and remove - although in that case, I wonder why the options exist to have them together in the first place? Perhaps it would be less confusing if you could either have add _ **or** _ remove? Alternatively, the Alias action could no longer be atomic so it runs sequentially maybe?

Anyway, I'll create individual actions for add and remove and we can go from there - perhaps I can split the config files this way which may make management easier?

Thanks for the reply 🙂

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [February 1, 2017, 7:24pm UTC](https://discuss.elastic.co/t/curator-alias-add-not-working-if-remove-list-is-empty/73549/4 "2017-02-01T19:24:14Z")

</div>

Your current use case will only exist for at most 8 days. After that, the atomic operation you started with won't be a problem.

I'll look at pruning an operation that doesn't have any indices.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 1, 2017, 7:24pm UTC](https://discuss.elastic.co/t/curator-alias-add-not-working-if-remove-list-is-empty/73549/5 "2017-03-01T19:24:40Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
