Curator _alias is created for all the indices rather than specified?

HI,

I created alias for indices that are in april , When i ran the command i got response like this:

2017-04-02 00:46:53,374 INFO      Preparing Action ID: 1, "alias"
2017-04-02 00:46:53,389 INFO      Trying Action ID: 1, "alias": Creating alias for apr month.
2017-04-02 00:46:53,411 INFO      Updating aliases...
2017-04-02 00:46:53,411 INFO      Alias actions: {'actions': [{'add': {'alias': 'apr_alias', 'index': 'data-sep-2017-09-01'}}, {'add': {'alias': 'apr_alias', 'index': 'data-july-2017-07-01'}}, {'add': {'alias': 'apr_alias', 'index': 'data-june-2017-06-01'}}, {'add': {'alias': 'apr_alias', 'index': 'data-dec-2017-12-01'}}, {'add': {'alias': 'apr_alias', 'index': 'data-august-2017-08-01'}}, {'add': {'alias': 'apr_alias', 'index': 'data-may-2017-05-01'}}, {'add': {'alias': 'apr_alias', 'index': 'data-apr-2017-04-01'}}, {'add': {'alias': 'apr_alias', 'index': 'data-oct-2017-10-01'}}, {'add': {'alias': 'apr_alias', 'index': 'data-nov-2017-11-01'}}, {'remove': {'alias': 'apr_alias', 'index': 'data-sep-2017-09-01'}}, {'remove': {'alias': 'apr_alias', 'index': 'data-july-2017-07-01'}}, {'remove': {'alias': 'apr_alias', 'index': 'data-june-2017-06-01'}}, {'remove': {'alias': 'apr_alias', 'index': 'data-dec-2017-12-01'}}, {'remove': {'alias': 'apr_alias', 'index': 'data-august-2017-08-01'}}, {'remove': {'alias': 'apr_alias', 'index': 'data-may-2017-05-01'}}, {'remove': {'alias': 'apr_alias', 'index': 'data-oct-2017-10-01'}}, {'remove': {'alias': 'apr_alias', 'index': 'data-nov-2017-11-01'}}]}
2017-04-02 00:46:53,774 INFO      Action ID: 1, "alias" completed.
2017-04-02 00:46:53,774 INFO      Job completed.

In the above response first it had added index to apr_alias and removed some indices except for the index that created on april(i.e .data-apr-2017-04-01). This is good that is what i want?

But when i checked GET _aliases command in sense plugin i see that the apr_aliases is created for every index rather than creating for the particular index(i.e.data-apr-2017-04-01).It is like this..

{
   "data-july-2017-07-01": {
      "aliases": {
         "apr_alias": {}
      }
   },
   "data-dec-2017-12-01": {
      "aliases": {
         "apr_alias": {}
      }
   },
   "data-june-2017-06-01": {
      "aliases": {
         "apr_alias": {}
      }
   },
   "data-jan-2017-01-01": {
      "aliases": {
         "jan_alias": {}
      }
   },
   "data-sep-2017-09-01": {
      "aliases": {
         "apr_alias": {}
      }
   },
   "data-nov-2017-11-01": {
      "aliases": {
         "apr_alias": {}
      }
   },
   "data-oct-2017-10-01": {
      "aliases": {
         "apr_alias": {}
      }
   },
   "data-feb-2017-02-01": {
      "aliases": {
         "feb_alias": {}
      }
   },
   "data-may-2017-05-01": {
      "aliases": {
         "apr_alias": {}
      }
   },
   "data-apr-2017-04-01": {
      "aliases": {
         "apr_alias": {}
      }
   },
   "data-august-2017-08-01": {
      "aliases": {
         "apr_alias": {}
      }
   },
   "data-mar-2017-03-01": {
      "aliases": {
         "mar_alias": {}
      }
   }
}

MAY I know why this is happening?

THANKS

Though the operation is atomic, if you have the same index being added and removed, it will be added. This is because the removes are parsed first. I can clearly see in your output that there are adds for those indices, so they persist.

It would also be helpful if you included your configuration.

Thanks..

My requirement is like this i need to create an alias for every month(i.e. jan_alias, feb_alias etc ) automatically since it cannot be done in index template i am coming to curator, even in curator too i have to run it for every month.

For testing purpose i had created the indices at every start date of every month(i.e.data-jan-2017-01-01,data-feb-2017-02-01 etc) as i mentioned above. For creating alias for data-jan-2017-01-01 i used only two filters keeping older and younger in such a way getting the in between days as i mentioned below:

- filtertype: age
        source: name
        direction: older
        timestring: '%Y-%m-%d'
        unit: days
        unit_count: 60
        exclude:
      - filtertype: age
        source: name
        direction: younger
        timestring: '%Y-%m-%d'
        unit: days
        unit_count: 91
        exclude:

Similarly i did for data-feb-2017-02-01,data-mar-2017-03-01. But for data-apr-2017-04-01 i used the below config like this:

actions:
  1:
    action: alias
    description: >-
      Creating alias for apr month.
    options:
      name: apr_alias
      extra_settings:
      timeout_override:
      continue_if_exception: False
      disable_action: False
    add:
      filters:
      - filtertype: pattern
        kind: prefix
        value: data-
        exclude:
      - filtertype: age
        source: name
        direction: younger
        timestring: '%Y-%m-%d'
        unit: days
        unit_count: 2
        exclude:
    remove:
      filters:
      - filtertype: pattern
        kind: prefix
        value: data-
      - filtertype: age
        source: name
        direction: younger
        timestring: '%Y-%m-%d'
        unit: days
        unit_count: 0
        exclude:

For the above config, it first adding apr_alias to all the indices and removing it except for data-apr-2017-04-01 . Since you said removes are parsed first . I don't know how to overcome this? Similarly i have to do it for data-may-2017-05-01,data-jun-2017-06-01 etc , i don't know how to filter them since i can use only younger filter on them.

Any help is highly appreciated..

Thanks

Curator is not going to be a terrific choice for creating aliases for a monthly block of indices, at least not until #733 is implemented.

Thanks for your confirmation on that. It really helped..

What will be the best choice for the above usecase?

Thanks

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

#733 was implemented in Curator 5.0, which has since been released.