# curator.actions.IndexSettings missing in Curator python lib?

**URL:** <https://discuss.elastic.co/t/curator-actions-indexsettings-missing-in-curator-python-lib/98868>\
**Category:** Elasticsearch\
**Created:** [August 30, 2017, 2:37pm UTC](https://discuss.elastic.co/t/curator-actions-indexsettings-missing-in-curator-python-lib/98868 "2017-08-30T14:37:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cornoualis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cornoualis/32/23246_2.png) [@Cornoualis](https://discuss.elastic.co/u/Cornoualis)\
**Post date:** [August 30, 2017, 2:37pm UTC](https://discuss.elastic.co/t/curator-actions-indexsettings-missing-in-curator-python-lib/98868/1 "2017-08-30T14:37:09Z")

</div>

I'm trying to use the [IndexSettings](https://curator.readthedocs.io/en/latest/actionclasses.html#indexsettings) action class in the curator python library:

```
ilo = curator.IndexList(es)
e= curator.actions.IndexSettings(ilo.all_indices, index_settings={"number_of_replicas": 1})

```

And I have this result:

```
AttributeError: module 'curator.validators.actions' has no attribute 'IndexSettings'

```

What am I doing wrong? I checked in the module source, and the class IndexSettings is here.

Thanks in advance!

---

<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:** [August 30, 2017, 3:41pm UTC](https://discuss.elastic.co/t/curator-actions-indexsettings-missing-in-curator-python-lib/98868/2 "2017-08-30T15:41:51Z")

</div>

First off, The `IndexSettings` object expects an `IndexList` object, but you are passing `ilo.all_indices`, which is not an `IndexList` object but a regular `list`. The proper way to use an `IndexList` object is to use the filter methods, and pass the whole object. If you apply no filter methods, all indices is implicit.

Second, I sincerely apologize for the way that the documentation makes it appear as though you need to call `curator.actions.IndexSettings`. Because of the way it's lumped into ` __init__.py`, it _must_ be referenced by `curator.IndexSettings`, otherwise you'll get an exception:

```auto
AttributeError: 'module' object has no attribute 'IndexSettings'

```

Using the full path was the only way I could make it print out properly using Sphinx documentation. The plus side, though, is that you can reference pretty much all of the classes and functions directly this way: `curator.CLASS` or `curator.FUNCTION`.

Third, you're missing the `'index'` root key for your `index_settings`. It must be `{'index':{'number_of_replicas':1}}`

After a few edits, this should work for you:

```auto
import elasticsearch
import curator
client = elasticsearch.Elasticsearch()
# This step is to add an index, as this is a test install with nothing else...
curator.CreateIndex(client, extra_settings={'settings':{'index.number_of_replicas':0}}, name='my_index').do_action()
ilo = curator.IndexList(client)
e = curator.IndexSettings(ilo, index_settings={"index":{"number_of_replicas": 1}})
e.do_action()

```

I tested this on a clean, single-node instance of Elasticsearch. The cluster health was "green" when I added the index, because I set it to have 0 replicas. It was "yellow" after running the `IndexSettings` action because the `number_of_replicas` was set to 1, but there's only 1 node, so the replica can't be created.

---

<div class="post-metadata">

**Author:** ![Cornoualis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cornoualis/32/23246_2.png) [@Cornoualis](https://discuss.elastic.co/u/Cornoualis)\
**Post date:** [August 30, 2017, 4:21pm UTC](https://discuss.elastic.co/t/curator-actions-indexsettings-missing-in-curator-python-lib/98868/3 "2017-08-30T16:21:52Z")

</div>

Yeah! It works!!

Thank you so much Aaron! 👍

---

<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:** [September 27, 2017, 4:22pm UTC](https://discuss.elastic.co/t/curator-actions-indexsettings-missing-in-curator-python-lib/98868/4 "2017-09-27T16:22:24Z")

</div>

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