# Can I update analyzer settings without recreating the index?

**URL:** <https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161>\
**Category:** Elasticsearch\
**Created:** [March 28, 2012, 7:43am UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161 "2012-03-28T07:43:35Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Dunn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_dunn/32/2315_2.png) [@Nick\_Dunn](https://discuss.elastic.co/u/Nick_Dunn)\
**Post date:** [March 28, 2012, 7:43am UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/1 "2012-03-28T07:43:35Z")

</div>

I am looking at using a hosted ES service ([Bonsai.io](http://Bonsai.io)) which offers an  
index per customer, pre-created. Usually I create a config file  
containing my custom analyzers and send this when creating an index,  
however because Bonsai provide the index already, this method will not  
work.

I've read the docs for the Updating Settings API for an index but it  
seems only certain settings can be modified this way, and not  
analyzers.

What are my options here? I've not heard of a way to update index  
custom analyzers without recreating an index, but perhaps I've missed  
something somewhere! Can I send custom analyzer config another way?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 28, 2012, 8:55am UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/2 "2012-03-28T08:55:17Z")

</div>

You can't change analyzer config on a "live" index using update settings,  
you can though close the index, send an update settings with the new  
analysis settings, and then open it back, though I am not sure of  
close/open are allowed in bonsai...

On Wed, Mar 28, 2012 at 9:43 AM, Nick Dunn [nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk) wrote:

> I am looking at using a hosted ES service ([Bonsai.io](http://Bonsai.io)) which offers an  
> index per customer, pre-created. Usually I create a config file  
> containing my custom analyzers and send this when creating an index,  
> however because Bonsai provide the index already, this method will not  
> work.
> 
> I've read the docs for the Updating Settings API for an index but it  
> seems only certain settings can be modified this way, and not  
> analyzers.
> 
> What are my options here? I've not heard of a way to update index  
> custom analyzers without recreating an index, but perhaps I've missed  
> something somewhere! Can I send custom analyzer config another way?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 30, 2012, 8:58pm UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/3 "2012-03-30T20:58:13Z")

</div>

Hi Shay,

Just to be sure to understand this.

If we want to merge settings (replication), we should (must ?) not close the  
index before sending an update settings.

But if we want to add a new analyzer, we must close the index before.

Is that it ?

I tried this in Java :

```
         // Before merging, we have to close the index

         CloseIndexRequestBuilder cirb =

```

client.admin().indices().prepareClose(index);

```
         CloseIndexResponse closeIndexResponse =

```

cirb.execute().actionGet();

```
         if (!closeIndexResponse.acknowledged()) throw new

```

Exception("Could not close index ["+index+"].");

```
         UpdateSettingsRequestBuilder usrb =

```

client.admin().indices().prepareUpdateSettings(index);

```
         // If there are settings for this index, we use it. If not,

```

using Elasticsearch defaults.

```
         String source = readIndexSettings(index);

         if (source != null) {

                if (logger.isTraceEnabled()) logger.trace("Found

```

settings for index "+index+" : " + source);

```
                usrb.setSettings(source);

         }

         

         usrb.execute().actionGet();

```

But it failed at the last line with a  
org.elasticsearch.indices.IndexMissingException: [twitter] missing

If I remove the closeIndex lines, I dont get the exception but I get the  
following warning :

22:56:48,843 WARN [metadata] [junit.node.transport] [twitter] ignoring non  
dynamic index level settings for open indices:  
[index.analysis.analyzer.type]

How to close an index and update settings in java ?

Thanks

David.

De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)]  
De la part de Shay Banon  
Envoyé : mercredi 28 mars 2012 10:55  
À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Objet : Re: Can I update analyzer settings without recreating the index?

You can't change analyzer config on a "live" index using update settings,  
you can though close the index, send an update settings with the new  
analysis settings, and then open it back, though I am not sure of close/open  
are allowed in bonsai...

On Wed, Mar 28, 2012 at 9:43 AM, Nick Dunn [nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk) wrote:

I am looking at using a hosted ES service (Bonsai.io) which offers an  
index per customer, pre-created. Usually I create a config file  
containing my custom analyzers and send this when creating an index,  
however because Bonsai provide the index already, this method will not  
work.

I've read the docs for the Updating Settings API for an index but it  
seems only certain settings can be modified this way, and not  
analyzers.

What are my options here? I've not heard of a way to update index  
custom analyzers without recreating an index, but perhaps I've missed  
something somewhere! Can I send custom analyzer config another way?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 31, 2012, 9:01pm UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/4 "2012-03-31T21:01:44Z")

</div>

Thats strange..., can you gist hte full failure? This works on 0.19:

curl -XPUT localhost:9200/test  
curl -XPOST localhost:9200/test/\_close

curl -XPUT localhost:9200/test/\_settings -d '{  
"index" : {  
"something" : "value"  
}  
}'

On Fri, Mar 30, 2012 at 11:58 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Hi Shay,\*\*\*\*
> 
> * * *
> 
> Just to be sure to understand this.\*\*\*\*
> 
> * * *
> 
> If we want to merge settings (replication), we should (must ?) not close  
> the index before sending an update settings.\*\*\*\*
> 
> But if we want to add a new analyzer, we must close the index before.\*\*\*\*
> 
> * * *
> 
> Is that it ?\*\*\*\*
> 
> * * *
> 
> I tried this in Java :\*\*\*\*
> 
> ```
> // Before merging, we have to close the index ****
> 
> CloseIndexRequestBuilder cirb = client
> 
> ```
> 
> .admin().indices().prepareClose(index);\*\*\*\*
> 
> ```
> CloseIndexResponse closeIndexResponse =
> 
> ```
> 
> cirb.execute().actionGet();\*\*\*\*
> 
> ```
> *if* (!closeIndexResponse.acknowledged()) *throw* *new*Exception("Could
> 
> ```
> 
> not close index ["+index+"].");\*\*\*\*
> 
> * * *
> 
> ```
> UpdateSettingsRequestBuilder usrb = client
> 
> ```
> 
> .admin().indices().prepareUpdateSettings(index);\*\*\*\*
> 
> * * *
> 
> ```
> // If there are settings for this index, we use it. If not,
> 
> ```
> 
> using _Elasticsearch_ defaults.\*\*\*\*
> 
> ```
> String source = readIndexSettings(index); ****
> 
> *if* (source != *null*) { ****
> 
> *if* (logger.isTraceEnabled()) logger.trace("Found
> 
> ```
> 
> settings for index "+index+" : " + source);\*\*\*\*
> 
> ```
> usrb.setSettings(source); ****
> 
> } ****
> 
> ****
> 
> usrb.execute().actionGet(); ****
> 
> ```
> 
> * * *
> 
> But it failed at the last line with a  
> org.elasticsearch.indices.IndexMissingException: [twitter] missing\*\*\*\*
> 
> * * *
> 
> If I remove the closeIndex lines, I don’t get the exception but I get the  
> following warning :\*\*\*\*
> 
> 22:56:48,843 WARN [metadata] [junit.node.transport] [twitter] ignoring  
> non dynamic index level settings for open indices:  
> [index.analysis.analyzer.type]\*\*\*\*
> 
> * * *
> 
> How to close an index and update settings in java ?\*\*\*\*
> 
> * * *
> 
> Thanks\*\*\*\*
> 
> David. \*\*\*\*
> 
> * * *
> 
> * * *
> 
> _De :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] _De la part de_ Shay Banon  
> _Envoyé :_ mercredi 28 mars 2012 10:55  
> _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> _Objet :_ Re: Can I update analyzer settings without recreating the index?
> 
> * * *
> 
> * * *
> 
> You can't change analyzer config on a "live" index using update settings,  
> you can though close the index, send an update settings with the new  
> analysis settings, and then open it back, though I am not sure of  
> close/open are allowed in bonsai...\*\*\*\*
> 
> On Wed, Mar 28, 2012 at 9:43 AM, Nick Dunn [nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk) wrote:\*\*  
> \*\*
> 
> I am looking at using a hosted ES service ([Bonsai.io](http://Bonsai.io)) which offers an  
> index per customer, pre-created. Usually I create a config file  
> containing my custom analyzers and send this when creating an index,  
> however because Bonsai provide the index already, this method will not  
> work.
> 
> I've read the docs for the Updating Settings API for an index but it  
> seems only certain settings can be modified this way, and not  
> analyzers.
> 
> What are my options here? I've not heard of a way to update index  
> custom analyzers without recreating an index, but perhaps I've missed  
> something somewhere! Can I send custom analyzer config another way?\*\*\*\*
> 
> * * *

---

<div class="post-metadata">

**Author:** ![Nick\_Zadrozny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_zadrozny/32/1150_2.png) [@Nick\_Zadrozny](https://discuss.elastic.co/u/Nick_Zadrozny)\
**Post date:** [March 31, 2012, 9:05pm UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/5 "2012-03-31T21:05:46Z")

</div>

On Wed, Mar 28, 2012 at 1:55 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> You can't change analyzer config on a "live" index using update settings,  
> you can though close the index, send an update settings with the new  
> analysis settings, and then open it back, though I am not sure of  
> close/open are allowed in bonsai...

As of today, all PUT and POST actions to the /index handler on Bonsai are  
restricted. But that's probably just for the beta as we continue to work  
our way through the various system- and user-facing stories and whitelist  
what's appropriate. (E.g., changing number of replicas should be  
restricted, changing the mapping should not.)

Shay, I'm going to send you an overdue ping off-list about our little  
project 🙂

--  
Nick Zadrozny

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 1, 2012, 7:49pm UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/6 "2012-04-01T19:49:46Z")

</div>

Hi Shay,

I think I understood where the error came from:

> <https://gist.github.com/dadoonet/2278029>

I cannot update number of replicas on a closed index.

So some properties have to be updated on a closed index and others on a live  
index.

My use case is for the Spring factory.

I want to update settings but I dont know what settings will set the user.

Is there a way to analyze the settings json file and split it in two  
settings files : one to be applied live and another to be applied closed ?

Do you have any class or method in ES that I can use for that ?

Or do I have to parse all the properties to find if one of them is in this  
list :  
[http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settin](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settin)  
gs.html so it has to be applied on a live index ?

Is there any reason that you cant apply all properties on a closed index ?  
Should I raise an issue ?

Thanks

David.

De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)]  
De la part de Shay Banon  
Envoyé : samedi 31 mars 2012 23:02  
À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Objet : Re: Can I update analyzer settings without recreating the index?

Thats strange..., can you gist hte full failure? This works on 0.19:

curl -XPUT localhost:9200/test

curl -XPOST localhost:9200/test/\_close

curl -XPUT localhost:9200/test/\_settings -d '{

```
"index" : {

    "something" : "value"

}

```

}'

On Fri, Mar 30, 2012 at 11:58 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

Hi Shay,

Just to be sure to understand this.

If we want to merge settings (replication), we should (must ?) not close the  
index before sending an update settings.

But if we want to add a new analyzer, we must close the index before.

Is that it ?

I tried this in Java :

```
         // Before merging, we have to close the index

         CloseIndexRequestBuilder cirb =

```

client.admin().indices().prepareClose(index);

```
         CloseIndexResponse closeIndexResponse =

```

cirb.execute().actionGet();

```
         if (!closeIndexResponse.acknowledged()) throw new

```

Exception("Could not close index ["+index+"].");

```
         UpdateSettingsRequestBuilder usrb =

```

client.admin().indices().prepareUpdateSettings(index);

```
         // If there are settings for this index, we use it. If not,

```

using Elasticsearch defaults.

```
         String source = readIndexSettings(index);

         if (source != null) {

                if (logger.isTraceEnabled()) logger.trace("Found

```

settings for index "+index+" : " + source);

```
                usrb.setSettings(source);

         }

         

         usrb.execute().actionGet();

```

But it failed at the last line with a  
org.elasticsearch.indices.IndexMissingException: [twitter] missing

If I remove the closeIndex lines, I dont get the exception but I get the  
following warning :

22:56:48,843 WARN [metadata] [junit.node.transport] [twitter] ignoring non  
dynamic index level settings for open indices:  
[index.analysis.analyzer.type]

How to close an index and update settings in java ?

Thanks

David.

De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)]  
De la part de Shay Banon  
Envoyé : mercredi 28 mars 2012 10:55  
À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Objet : Re: Can I update analyzer settings without recreating the index?

You can't change analyzer config on a "live" index using update settings,  
you can though close the index, send an update settings with the new  
analysis settings, and then open it back, though I am not sure of close/open  
are allowed in bonsai...

On Wed, Mar 28, 2012 at 9:43 AM, Nick Dunn [nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk) wrote:

I am looking at using a hosted ES service (Bonsai.io) which offers an  
index per customer, pre-created. Usually I create a config file  
containing my custom analyzers and send this when creating an index,  
however because Bonsai provide the index already, this method will not  
work.

I've read the docs for the Updating Settings API for an index but it  
seems only certain settings can be modified this way, and not  
analyzers.

What are my options here? I've not heard of a way to update index  
custom analyzers without recreating an index, but perhaps I've missed  
something somewhere! Can I send custom analyzer config another way?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 3, 2012, 2:10pm UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/7 "2012-04-03T14:10:50Z")

</div>

Yea, only the list mentioned in the update settings can be applied  
dynamically, while other settings can be applied on a closed index. The  
number of replicas can be updated on a live index though...

On Sun, Apr 1, 2012 at 10:49 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Hi Shay,\*\*\*\*
> 
> * * *
> 
> I think I understood where the error came from:  
> [Error while updating settings on a closed index · GitHub](https://gist.github.com/2278029)\*\*\*\*
> 
> * * *
> 
> I cannot update number of replicas on a closed index.\*\*\*\*
> 
> * * *
> 
> So some properties have to be updated on a closed index and others on a  
> live index.\*\*\*\*
> 
> * * *
> 
> * * *
> 
> My use case is for the Spring factory.\*\*\*\*
> 
> I want to update settings but I don’t know what settings will set the user.
> 
> * * *
> 
> * * *
> 
> Is there a way to analyze the settings json file and split it in two  
> settings files : one to be applied live and another to be applied closed ?
> 
> * * *
> 
> Do you have any class or method in ES that I can use for that ?\*\*\*\*
> 
> * * *
> 
> Or do I have to parse all the properties to find if one of them is in this  
> list :  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.htmlso) it has to be applied on a live index ?
> 
> * * *
> 
> * * *
> 
> Is there any reason that you can’t apply all properties on a closed index  
> ? Should I raise an issue ?\*\*\*\*
> 
> * * *
> 
> * * *
> 
> Thanks\*\*\*\*
> 
> David.\*\*\*\*
> 
> * * *
> 
> * * *
> 
> _De :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] _De la part de_ Shay Banon  
> _Envoyé :_ samedi 31 mars 2012 23:02
> 
> _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> _Objet :_ Re: Can I update analyzer settings without recreating the index?
> 
> * * *
> 
> * * *
> 
> Thats strange..., can you gist hte full failure? This works on 0.19:\*\*\*\*
> 
> * * *
> 
> curl -XPUT localhost:9200/test\*\*\*\*
> 
> curl -XPOST localhost:9200/test/\_close\*\*\*\*
> 
> * * *
> 
> curl -XPUT localhost:9200/test/\_settings -d '{\*\*\*\*
> 
> ```
> "index" : { ****
> 
> "something" : "value" ****
> 
> } ****
> 
> ```
> 
> }'\*\*\*\*
> 
> * * *
> 
> * * *
> 
> On Fri, Mar 30, 2012 at 11:58 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:\*\*\*  
> \*
> 
> Hi Shay,\*\*\*\*
> 
> * * *
> 
> Just to be sure to understand this.\*\*\*\*
> 
> * * *
> 
> If we want to merge settings (replication), we should (must ?) not close  
> the index before sending an update settings.\*\*\*\*
> 
> But if we want to add a new analyzer, we must close the index before.\*\*\*\*
> 
> * * *
> 
> Is that it ?\*\*\*\*
> 
> * * *
> 
> I tried this in Java :\*\*\*\*
> 
> ```
> // Before merging, we have to close the index ****
> 
> CloseIndexRequestBuilder cirb = client
> 
> ```
> 
> .admin().indices().prepareClose(index);\*\*\*\*
> 
> ```
> CloseIndexResponse closeIndexResponse =
> 
> ```
> 
> cirb.execute().actionGet();\*\*\*\*
> 
> ```
> *if* (!closeIndexResponse.acknowledged()) *throw* *new*Exception("Could
> 
> ```
> 
> not close index ["+index+"].");\*\*\*\*
> 
> * * *
> 
> ```
> UpdateSettingsRequestBuilder usrb = client
> 
> ```
> 
> .admin().indices().prepareUpdateSettings(index);\*\*\*\*
> 
> * * *
> 
> ```
> // If there are settings for this index, we use it. If not,
> 
> ```
> 
> using _Elasticsearch_ defaults.\*\*\*\*
> 
> ```
> String source = readIndexSettings(index); ****
> 
> *if* (source != *null*) { ****
> 
> *if* (logger.isTraceEnabled()) logger.trace("Found
> 
> ```
> 
> settings for index "+index+" : " + source);\*\*\*\*
> 
> ```
> usrb.setSettings(source); ****
> 
> } ****
> 
> ****
> 
> usrb.execute().actionGet(); ****
> 
> ```
> 
> * * *
> 
> But it failed at the last line with a  
> org.elasticsearch.indices.IndexMissingException: [twitter] missing\*\*\*\*
> 
> * * *
> 
> If I remove the closeIndex lines, I don’t get the exception but I get the  
> following warning :\*\*\*\*
> 
> 22:56:48,843 WARN [metadata] [junit.node.transport] [twitter] ignoring  
> non dynamic index level settings for open indices:  
> [index.analysis.analyzer.type]\*\*\*\*
> 
> * * *
> 
> How to close an index and update settings in java ?\*\*\*\*
> 
> * * *
> 
> Thanks\*\*\*\*
> 
> David. \*\*\*\*
> 
> * * *
> 
> * * *
> 
> _De :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] _De la part de_ Shay Banon  
> _Envoyé :_ mercredi 28 mars 2012 10:55  
> _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> _Objet :_ Re: Can I update analyzer settings without recreating the index?
> 
> * * *
> 
> * * *
> 
> You can't change analyzer config on a "live" index using update settings,  
> you can though close the index, send an update settings with the new  
> analysis settings, and then open it back, though I am not sure of  
> close/open are allowed in bonsai...\*\*\*\*
> 
> On Wed, Mar 28, 2012 at 9:43 AM, Nick Dunn [nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk) wrote:\*\*  
> \*\*
> 
> I am looking at using a hosted ES service ([Bonsai.io](http://Bonsai.io)) which offers an  
> index per customer, pre-created. Usually I create a config file  
> containing my custom analyzers and send this when creating an index,  
> however because Bonsai provide the index already, this method will not  
> work.
> 
> I've read the docs for the Updating Settings API for an index but it  
> seems only certain settings can be modified this way, and not  
> analyzers.
> 
> What are my options here? I've not heard of a way to update index  
> custom analyzers without recreating an index, but perhaps I've missed  
> something somewhere! Can I send custom analyzer config another way?\*\*\*\*
> 
> * * *
> 
> * * *

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 3, 2012, 3:25pm UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/8 "2012-04-03T15:25:20Z")

</div>

Just for understand, is there any technical reason that we can not update  
all settings on a closed index ?  
I can understand for an opened index but I don't understand why there is  
this _restriction_ ?

My other question is : can I find somewhere in ES source code a method that  
I can use to parse (precheck) settings on my side before trying to push to  
ES settings that couldn't be applied ?

Thanks,  
David.

Le 3 avril 2012 à 16:10, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) a écrit :

> Yea, only the list mentioned in the update settings can be applied  
> dynamically, while other settings can be applied on a closed index. The  
> number of replicas can be updated on a live index though...
> 
> On Sun, Apr 1, 2012 at 10:49 PM, David Pilato \< [david@pilato.fr](mailto:david@pilato.fr)  
> [mailto:david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> 
> > Hi Shay,
> > 
> > I think I understood where the error came from:  
> > [Error while updating settings on a closed index · GitHub](https://gist.github.com/2278029) [https://gist.github.com/2278029](https://gist.github.com/2278029)
> > 
> > I cannot update number of replicas on a closed index.
> > 
> > So some properties have to be updated on a closed index and others on a  
> > live index.
> > 
> > My use case is for the Spring factory.
> > 
> > I want to update settings but I don’t know what settings will set the user.
> > 
> > Is there a way to analyze the settings json file and split it in two  
> > settings files : one to be applied live and another to be applied closed ?
> > 
> > Do you have any class or method in ES that I can use for that ?
> > 
> > Or do I have to parse all the properties to find if one of them is in this  
> > list :  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html)  
> > [http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html)  
> > so it has to be applied on a live index ?
> > 
> > Is there any reason that you can’t apply all properties on a closed index ?  
> > Should I raise an issue ?
> > 
> > Thanks
> > 
> > David.
> > 
> > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > [mailto: [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) ] De la part de Shay Banon  
> > Envoyé : samedi 31 mars 2012 23:02
> > 
> > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > Objet : Re: Can I update analyzer settings without recreating the index?
> > 
> > Thats strange..., can you gist hte full failure? This works on 0.19:
> > 
> > curl -XPUT localhost:9200/test
> > 
> > curl -XPOST localhost:9200/test/\_close
> > 
> > curl -XPUT localhost:9200/test/\_settings -d '{
> > 
> > ```
> > "index" : {
> > 
> > "something" : "value"
> > 
> > }
> > 
> > ```
> > 
> > }'
> > 
> > On Fri, Mar 30, 2012 at 11:58 PM, David Pilato \< [david@pilato.fr](mailto:david@pilato.fr)  
> > [mailto:david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> > 
> > Hi Shay,
> > 
> > Just to be sure to understand this.
> > 
> > If we want to merge settings (replication), we should (must ?) not close  
> > the index before sending an update settings.
> > 
> > But if we want to add a new analyzer, we must close the index before.
> > 
> > Is that it ?
> > 
> > I tried this in Java :
> > 
> > ```
> > // Before merging, we have to close the index
> > 
> > CloseIndexRequestBuilder cirb = client
> > 
> > ```
> > 
> > .admin().indices().prepareClose(index);
> > 
> > ```
> > CloseIndexResponse closeIndexResponse =
> > 
> > ```
> > 
> > cirb.execute().actionGet();
> > 
> > ```
> > if (!closeIndexResponse.acknowledged()) throw new Exception(
> > 
> > ```
> > 
> > "Could not close index [" +index+ "]." );
> > 
> > ```
> > UpdateSettingsRequestBuilder usrb = client
> > 
> > ```
> > 
> > .admin().indices().prepareUpdateSettings(index);
> > 
> > ```
> > // If there are settings for this index, we use it. If not,
> > 
> > ```
> > 
> > using Elasticsearch defaults.
> > 
> > ```
> > String source = readIndexSettings(index);
> > 
> > if (source != null ) {
> > 
> > if ( logger .isTraceEnabled()) logger .trace( "Found
> > 
> > ```
> > 
> > settings for index " +index+ " : " + source);
> > 
> > ```
> > usrb.setSettings(source);
> > 
> > }
> > 
> > usrb.execute().actionGet();
> > 
> > ```
> > 
> > But it failed at the last line with a  
> > org.elasticsearch.indices.IndexMissingException: [twitter] missing
> > 
> > If I remove the closeIndex lines, I don’t get the exception but I get the  
> > following warning :
> > 
> > 22:56:48,843 WARN [metadata] [junit.node.transport] [twitter] ignoring non  
> > dynamic index level settings for open indices:  
> > [index.analysis.analyzer.type]
> > 
> > How to close an index and update settings in java ?
> > 
> > Thanks
> > 
> > David.
> > 
> > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > [mailto: [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) ] De la part de Shay Banon  
> > Envoyé : mercredi 28 mars 2012 10:55  
> > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > Objet : Re: Can I update analyzer settings without recreating the index?
> > 
> > You can't change analyzer config on a "live" index using update settings,  
> > you can though close the index, send an update settings with the new  
> > analysis settings, and then open it back, though I am not sure of  
> > close/open are allowed in bonsai...
> > 
> > On Wed, Mar 28, 2012 at 9:43 AM, Nick Dunn \< [nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk)  
> > [mailto:nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk) \> wrote:
> > 
> > I am looking at using a hosted ES service ([Bonsai.io](http://Bonsai.io)) which offers an  
> > index per customer, pre-created. Usually I create a config file  
> > containing my custom analyzers and send this when creating an index,  
> > however because Bonsai provide the index already, this method will not  
> > work.
> > 
> > I've read the docs for the Updating Settings API for an index but it  
> > seems only certain settings can be modified this way, and not  
> > analyzers.
> > 
> > What are my options here? I've not heard of a way to update index  
> > custom analyzers without recreating an index, but perhaps I've missed  
> > something somewhere! Can I send custom analyzer config another way?

--  
David Pilato  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 4, 2012, 3:25pm UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/9 "2012-04-04T15:25:32Z")

</div>

On Tue, Apr 3, 2012 at 6:25 PM, [david@pilato.fr](mailto:david@pilato.fr) [david@pilato.fr](mailto:david@pilato.fr) wrote:

> \*\*
> 
> Just for understand, is there any technical reason that we can not update  
> all settings on a closed index ?
> 
> I can understand for an opened index but I don't understand why there is  
> this _restriction_ ?

You can update any setting on a closed index, there ins't a restriction  
there.

> My other question is : can I find somewhere in ES source code a method  
> that I can use to parse (precheck) settings on my side before trying to  
> push to ES settings that couldn't be applied ?

There isn't really... . Its spread in each component that reads its own  
relevant setting.

> Thanks,
> 
> David.
> 
> Le 3 avril 2012 à 16:10, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) a écrit :
> 
> Yea, only the list mentioned in the update settings can be applied  
> dynamically, while other settings can be applied on a closed index. The  
> number of replicas can be updated on a live index though...
> 
> On Sun, Apr 1, 2012 at 10:49 PM, David Pilato \< [david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> 
> Hi Shay,
> 
> I think I understood where the error came from:  
> [Error while updating settings on a closed index · GitHub](https://gist.github.com/2278029)
> 
> I cannot update number of replicas on a closed index.
> 
> So some properties have to be updated on a closed index and others on a  
> live index.
> 
> My use case is for the Spring factory.
> 
> I want to update settings but I don’t know what settings will set the  
> user.
> 
> Is there a way to analyze the settings json file and split it in two  
> settings files : one to be applied live and another to be applied closed ?
> 
> Do you have any class or method in ES that I can use for that ?
> 
> Or do I have to parse all the properties to find if one of them is in  
> this list :  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.htmlso) it has to be applied on a live index ?
> 
> Is there any reason that you can’t apply all properties on a closed index  
> ? Should I raise an issue ?
> 
> Thanks
> 
> David.
> 
> - De : \* [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) ] _De la part de_ Shay Banon
> - Envoyé : \* samedi 31 mars 2012 23:02
> 
> _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> _Objet :_ Re: Can I update analyzer settings without recreating the  
> index?
> 
> Thats strange..., can you gist hte full failure? This works on 0.19:
> 
> curl -XPUT localhost:9200/test
> 
> curl -XPOST localhost:9200/test/\_close
> 
> curl -XPUT localhost:9200/test/\_settings -d '{
> 
> ```
> "index" : {
> 
> "something" : "value"
> 
> }
> 
> ```
> 
> }'
> 
> On Fri, Mar 30, 2012 at 11:58 PM, David Pilato \< [david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> 
> Hi Shay,
> 
> Just to be sure to understand this.
> 
> If we want to merge settings (replication), we should (must ?) not close  
> the index before sending an update settings.
> 
> But if we want to add a new analyzer, we must close the index before.
> 
> Is that it ?
> 
> I tried this in Java :
> 
> ```
> // Before merging, we have to close the index
> 
> CloseIndexRequestBuilder cirb = client.admin().indices().prepareClose(index);
> 
> CloseIndexResponse closeIndexResponse =
> 
> ```
> 
> cirb.execute().actionGet();
> 
> ```
> * if * (!closeIndexResponse.acknowledged()) * throw * * new
> 
> ```
> 
> - Exception( "Could not close index [" +index+ "]." );
> 
> using Elasticsearch defaults.
> 
> ```
> String source = readIndexSettings(index);
> 
> * if * (source != * null * ) {
> 
> * if * ( logger .isTraceEnabled()) logger .trace( "Found
> 
> ```
> 
> settings for index " +index+ " : " + source);
> 
> ```
> usrb.setSettings(source);
> 
> }
> 
> usrb.execute().actionGet();
> 
> ```
> 
> But it failed at the last line with a  
> org.elasticsearch.indices.IndexMissingException: [twitter] missing
> 
> If I remove the closeIndex lines, I don’t get the exception but I get the  
> following warning :
> 
> 22:56:48,843 WARN [metadata] [junit.node.transport] [twitter] ignoring  
> non dynamic index level settings for open indices:  
> [index.analysis.analyzer.type]
> 
> How to close an index and update settings in java ?
> 
> Thanks
> 
> David.
> 
> - De : \* [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) ] _De la part de_ Shay Banon  
> _Envoyé :_ mercredi 28 mars 2012 10:55  
> _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> _Objet :_ Re: Can I update analyzer settings without recreating the  
> index?
> 
> You can't change analyzer config on a "live" index using update settings,  
> you can though close the index, send an update settings with the new  
> analysis settings, and then open it back, though I am not sure of  
> close/open are allowed in bonsai...
> 
> On Wed, Mar 28, 2012 at 9:43 AM, Nick Dunn \< [nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk) \>  
> wrote:
> 
> I am looking at using a hosted ES service ([Bonsai.io](http://Bonsai.io)) which offers an  
> index per customer, pre-created. Usually I create a config file  
> containing my custom analyzers and send this when creating an index,  
> however because Bonsai provide the index already, this method will not  
> work.
> 
> I've read the docs for the Updating Settings API for an index but it  
> seems only certain settings can be modified this way, and not  
> analyzers.
> 
> What are my options here? I've not heard of a way to update index  
> custom analyzers without recreating an index, but perhaps I've missed  
> something somewhere! Can I send custom analyzer config another way?
> 
> --  
> David Pilato  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 4, 2012, 3:43pm UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/10 "2012-04-04T15:43:12Z")

</div>

Heya,

So why did my update of "number of replicas" on the closed index fails with  
that error ?  
Caused by: org.elasticsearch.indices.IndexMissingException: [twitter]  
missing  
at  
org.elasticsearch.cluster.routing.RoutingTable$Builder.updateNumberOfReplicas(RoutingTable.java:314)

It should work on a closed index as you wrote. Is it a bug or am I doing  
something weird ?

David.

Le 4 avril 2012 à 17:25, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) a écrit :

> On Tue, Apr 3, 2012 at 6:25 PM, [david@pilato.fr](mailto:david@pilato.fr) [mailto:david@pilato.fr](mailto:david@pilato.fr) \<  
> [david@pilato.fr](mailto:david@pilato.fr) [mailto:david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> 
> > Just for understand, is there any technical reason that we can not update  
> > all settings on a closed index ?  
> > I can understand for an opened index but I don't understand why there is  
> > this _restriction_ ?
> > 
> > You can update any setting on a closed index, there ins't a restriction  
> > there.
> > 
> > > My other question is : can I find somewhere in ES source code a method  
> > > that  
> > > I can use to parse (precheck) settings on my side before trying to push to  
> > > ES settings that couldn't be applied ?
> > > 
> > > There isn't really... . Its spread in each component that reads its own  
> > > relevant setting.
> > > 
> > > > Thanks,  
> > > > David.
> > > > 
> > > > Le 3 avril 2012 à 16:10, Shay Banon \< [kimchy@gmail.com](mailto:kimchy@gmail.com)  
> > > > [mailto:kimchy@gmail.com](mailto:kimchy@gmail.com) \> a écrit :
> > > > 
> > > > Yea, only the list mentioned in the update settings can be applied  
> > > > dynamically, while other settings can be applied on a closed index. The  
> > > > number of replicas can be updated on a live index though...  
> > > > On Sun, Apr 1, 2012 at 10:49 PM, David Pilato \< [david@pilato.fr](mailto:david@pilato.fr)  
> > > > [mailto:david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> > > > 
> > > > Hi Shay,
> > > > 
> > > > I think I understood where the error came from:  
> > > > [Error while updating settings on a closed index · GitHub](https://gist.github.com/2278029) [https://gist.github.com/2278029](https://gist.github.com/2278029)
> > > > 
> > > > I cannot update number of replicas on a closed index.
> > > > 
> > > > So some properties have to be updated on a closed index and others on a  
> > > > live index.
> > > > 
> > > > My use case is for the Spring factory.
> > > > 
> > > > I want to update settings but I don’t know what settings will set the  
> > > > user.
> > > > 
> > > > Is there a way to analyze the settings json file and split it in two  
> > > > settings files : one to be applied live and another to be applied closed  
> > > > ?
> > > > 
> > > > Do you have any class or method in ES that I can use for that ?
> > > > 
> > > > Or do I have to parse all the properties to find if one of them is in  
> > > > this  
> > > > list :  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html)  
> > > > [http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html)  
> > > > so it has to be applied on a live index ?
> > > > 
> > > > Is there any reason that you can’t apply all properties on a closed  
> > > > index ?  
> > > > Should I raise an issue ?
> > > > 
> > > > Thanks
> > > > 
> > > > David.
> > > > 
> > > > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > [mailto: [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) ] De la part de Shay Banon  
> > > > Envoyé : samedi 31 mars 2012 23:02
> > > > 
> > > > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > Objet : Re: Can I update analyzer settings without recreating the index?
> > > > 
> > > > Thats strange..., can you gist hte full failure? This works on 0.19:
> > > > 
> > > > curl -XPUT localhost:9200/test
> > > > 
> > > > curl -XPOST localhost:9200/test/\_close
> > > > 
> > > > curl -XPUT localhost:9200/test/\_settings -d '{
> > > > 
> > > > ```
> > > > "index" : {
> > > > 
> > > > "something" : "value"
> > > > 
> > > > }
> > > > 
> > > > ```
> > > > 
> > > > }'
> > > > 
> > > > On Fri, Mar 30, 2012 at 11:58 PM, David Pilato \< [david@pilato.fr](mailto:david@pilato.fr)  
> > > > [mailto:david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> > > > 
> > > > Hi Shay,
> > > > 
> > > > Just to be sure to understand this.
> > > > 
> > > > If we want to merge settings (replication), we should (must ?) not close  
> > > > the index before sending an update settings.
> > > > 
> > > > But if we want to add a new analyzer, we must close the index before.
> > > > 
> > > > Is that it ?
> > > > 
> > > > I tried this in Java :
> > > > 
> > > > ```
> > > > // Before merging, we have to close the index
> > > > 
> > > > CloseIndexRequestBuilder cirb = client
> > > > 
> > > > ```
> > > > 
> > > > .admin().indices().prepareClose(index);
> > > > 
> > > > ```
> > > > CloseIndexResponse closeIndexResponse =
> > > > 
> > > > ```
> > > > 
> > > > cirb.execute().actionGet();
> > > > 
> > > > ```
> > > > if (!closeIndexResponse.acknowledged()) throw new
> > > > 
> > > > ```
> > > > 
> > > > Exception(  
> > > > "Could not close index [" +index+ "]." );
> > > > 
> > > > ```
> > > > UpdateSettingsRequestBuilder usrb = client
> > > > 
> > > > ```
> > > > 
> > > > .admin().indices().prepareUpdateSettings(index);
> > > > 
> > > > ```
> > > > // If there are settings for this index, we use it. If not,
> > > > 
> > > > ```
> > > > 
> > > > using Elasticsearch defaults.
> > > > 
> > > > ```
> > > > String source = readIndexSettings(index);
> > > > 
> > > > if (source != null ) {
> > > > 
> > > > if ( logger .isTraceEnabled()) logger .trace( "Found
> > > > 
> > > > ```
> > > > 
> > > > settings for index " +index+ " : " + source);
> > > > 
> > > > ```
> > > > usrb.setSettings(source);
> > > > 
> > > > }
> > > > 
> > > > usrb.execute().actionGet();
> > > > 
> > > > ```
> > > > 
> > > > But it failed at the last line with a  
> > > > org.elasticsearch.indices.IndexMissingException: [twitter] missing
> > > > 
> > > > If I remove the closeIndex lines, I don’t get the exception but I get  
> > > > the  
> > > > following warning :
> > > > 
> > > > 22:56:48,843 WARN [metadata] [junit.node.transport] [twitter] ignoring  
> > > > non  
> > > > dynamic index level settings for open indices:  
> > > > [index.analysis.analyzer.type]
> > > > 
> > > > How to close an index and update settings in java ?
> > > > 
> > > > Thanks
> > > > 
> > > > David.
> > > > 
> > > > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > [mailto: [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) ] De la part de Shay Banon  
> > > > Envoyé : mercredi 28 mars 2012 10:55  
> > > > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > [mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > Objet : Re: Can I update analyzer settings without recreating the index?
> > > > 
> > > > You can't change analyzer config on a "live" index using update  
> > > > settings,  
> > > > you can though close the index, send an update settings with the new  
> > > > analysis settings, and then open it back, though I am not sure of  
> > > > close/open are allowed in bonsai...
> > > > 
> > > > On Wed, Mar 28, 2012 at 9:43 AM, Nick Dunn \< [nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk)  
> > > > [mailto:nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk) \> wrote:
> > > > 
> > > > I am looking at using a hosted ES service ([Bonsai.io](http://Bonsai.io)) which offers an  
> > > > index per customer, pre-created. Usually I create a config file  
> > > > containing my custom analyzers and send this when creating an index,  
> > > > however because Bonsai provide the index already, this method will not  
> > > > work.
> > > > 
> > > > I've read the docs for the Updating Settings API for an index but it  
> > > > seems only certain settings can be modified this way, and not  
> > > > analyzers.
> > > > 
> > > > What are my options here? I've not heard of a way to update index  
> > > > custom analyzers without recreating an index, but perhaps I've missed  
> > > > something somewhere! Can I send custom analyzer config another way?
> > 
> > --  
> > David Pilato  
> > [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/) [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> > Twitter : @dadoonet

--  
David Pilato  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 4, 2012, 3:46pm UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/11 "2012-04-04T15:46:17Z")

</div>

It might just be the number of replicas setting, where it should handle  
things better in case of a closed index. All other settings should work.  
Open an issue for the number of replica settings update problem on a closed  
index.

On Wed, Apr 4, 2012 at 6:43 PM, [david@pilato.fr](mailto:david@pilato.fr) [david@pilato.fr](mailto:david@pilato.fr) wrote:

> \*\*
> 
> Heya,
> 
> So why did my update of "number of replicas" on the closed index fails  
> with that error ?  
> Caused by: org.elasticsearch.indices.IndexMissingException: [twitter]  
> missing  
> at  
> org.elasticsearch.cluster.routing.RoutingTable$Builder.updateNumberOfReplicas(RoutingTable.java:314)
> 
> It should work on a closed index as you wrote. Is it a bug or am I doing  
> something weird ?
> 
> David.
> 
> Le 4 avril 2012 à 17:25, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) a écrit :
> 
> On Tue, Apr 3, 2012 at 6:25 PM, [david@pilato.fr](mailto:david@pilato.fr) \< [david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> 
> Just for understand, is there any technical reason that we can not  
> update all settings on a closed index ?
> 
> I can understand for an opened index but I don't understand why there is  
> this _restriction_ ?
> 
> You can update any setting on a closed index, there ins't a restriction  
> there.
> 
> My other question is : can I find somewhere in ES source code a method  
> that I can use to parse (precheck) settings on my side before trying to  
> push to ES settings that couldn't be applied ?
> 
> There isn't really... . Its spread in each component that reads its own  
> relevant setting.
> 
> Thanks,
> 
> David.
> 
> Le 3 avril 2012 à 16:10, Shay Banon \< [kimchy@gmail.com](mailto:kimchy@gmail.com) \> a écrit :
> 
> Yea, only the list mentioned in the update settings can be applied  
> dynamically, while other settings can be applied on a closed index. The  
> number of replicas can be updated on a live index though...  
> On Sun, Apr 1, 2012 at 10:49 PM, David Pilato \< [david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> 
> Hi Shay,
> 
> I think I understood where the error came from:  
> [Error while updating settings on a closed index · GitHub](https://gist.github.com/2278029)
> 
> I cannot update number of replicas on a closed index.
> 
> So some properties have to be updated on a closed index and others on a  
> live index.
> 
> My use case is for the Spring factory.
> 
> I want to update settings but I don’t know what settings will set the user.
> 
> Is there a way to analyze the settings json file and split it in two  
> settings files : one to be applied live and another to be applied closed ?
> 
> Do you have any class or method in ES that I can use for that ?
> 
> Or do I have to parse all the properties to find if one of them is in  
> this list :  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.htmlso) it has to be applied on a live index ?
> 
> Is there any reason that you can’t apply all properties on a closed index  
> ? Should I raise an issue ?
> 
> Thanks
> 
> David.
> 
> - De : \* [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) ] _De la part de_ Shay Banon
> - Envoyé : \* samedi 31 mars 2012 23:02
> 
> _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> _Objet :_ Re: Can I update analyzer settings without recreating the  
> index?
> 
> Thats strange..., can you gist hte full failure? This works on 0.19:
> 
> curl -XPUT localhost:9200/test
> 
> curl -XPOST localhost:9200/test/\_close
> 
> curl -XPUT localhost:9200/test/\_settings -d '{
> 
> ```
> "index" : {
> 
> "something" : "value"
> 
> }
> 
> ```
> 
> }'
> 
> On Fri, Mar 30, 2012 at 11:58 PM, David Pilato \< [david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> 
> Hi Shay,
> 
> Just to be sure to understand this.
> 
> If we want to merge settings (replication), we should (must ?) not close  
> the index before sending an update settings.
> 
> But if we want to add a new analyzer, we must close the index before.
> 
> Is that it ?
> 
> I tried this in Java :
> 
> ```
> // Before merging, we have to close the index
> 
> CloseIndexRequestBuilder cirb = client.admin().indices().prepareClose(index);
> 
> CloseIndexResponse closeIndexResponse =
> 
> ```
> 
> cirb.execute().actionGet();
> 
> ```
> * if * (!closeIndexResponse.acknowledged()) * throw * * new
> 
> ```
> 
> - Exception( "Could not close index [" +index+ "]." );
> 
> using Elasticsearch defaults.
> 
> ```
> String source = readIndexSettings(index);
> 
> * if * (source != * null * ) {
> 
> * if * ( logger .isTraceEnabled()) logger .trace( "Found
> 
> ```
> 
> settings for index " +index+ " : " + source);
> 
> ```
> usrb.setSettings(source);
> 
> }
> 
> usrb.execute().actionGet();
> 
> ```
> 
> But it failed at the last line with a  
> org.elasticsearch.indices.IndexMissingException: [twitter] missing
> 
> If I remove the closeIndex lines, I don’t get the exception but I get the  
> following warning :
> 
> 22:56:48,843 WARN [metadata] [junit.node.transport] [twitter] ignoring  
> non dynamic index level settings for open indices:  
> [index.analysis.analyzer.type]
> 
> How to close an index and update settings in java ?
> 
> Thanks
> 
> David.
> 
> - De : \* [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) ] _De la part de_ Shay Banon  
> _Envoyé :_ mercredi 28 mars 2012 10:55  
> _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> _Objet :_ Re: Can I update analyzer settings without recreating the  
> index?
> 
> You can't change analyzer config on a "live" index using update settings,  
> you can though close the index, send an update settings with the new  
> analysis settings, and then open it back, though I am not sure of  
> close/open are allowed in bonsai...
> 
> On Wed, Mar 28, 2012 at 9:43 AM, Nick Dunn \< [nick@nick-dunn.co.uk](mailto:nick@nick-dunn.co.uk) \>  
> wrote:
> 
> I am looking at using a hosted ES service ([Bonsai.io](http://Bonsai.io)) which offers an  
> index per customer, pre-created. Usually I create a config file  
> containing my custom analyzers and send this when creating an index,  
> however because Bonsai provide the index already, this method will not  
> work.
> 
> I've read the docs for the Updating Settings API for an index but it  
> seems only certain settings can be modified this way, and not  
> analyzers.
> 
> What are my options here? I've not heard of a way to update index  
> custom analyzers without recreating an index, but perhaps I've missed  
> something somewhere! Can I send custom analyzer config another way?
> 
> --  
> David Pilato  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet
> 
> --  
> David Pilato  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 4, 2012, 7:05pm UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/12 "2012-04-04T19:05:08Z")

</div>

Thanks. Opened here :

> <https://github.com/elastic/elasticsearch/issues/1845>

David

De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)]  
De la part de Shay Banon  
Envoyé : mercredi 4 avril 2012 17:46  
À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Objet : Re: Can I update analyzer settings without recreating the index?

It might just be the number of replicas setting, where it should handle  
things better in case of a closed index. All other settings should work.  
Open an issue for the number of replica settings update problem on a closed  
index.

On Wed, Apr 4, 2012 at 6:43 PM, david@pilato.fr [david@pilato.fr](mailto:david@pilato.fr) wrote:

Heya,

So why did my update of "number of replicas" on the closed index fails with  
that error ?

Caused by: org.elasticsearch.indices.IndexMissingException: [twitter]  
missing

```
    at

```

org.elasticsearch.cluster.routing.RoutingTable$Builder.updateNumberOfReplica  
s(RoutingTable.java:314)

It should work on a closed index as you wrote. Is it a bug or am I doing  
something weird ?

David.

Le 4 avril 2012 à 17:25, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) a écrit :

On Tue, Apr 3, 2012 at 6:25 PM, david@pilato.fr \< david@pilato.fr \> wrote:

Just for understand, is there any technical reason that we can not update  
all settings on a closed index ?

I can understand for an opened index but I don't understand why there is  
this _restriction_ ?

You can update any setting on a closed index, there ins't a restriction  
there.

My other question is : can I find somewhere in ES source code a method that  
I can use to parse (precheck) settings on my side before trying to push to  
ES settings that couldn't be applied ?

There isn't really... . Its spread in each component that reads its own  
relevant setting.

Thanks,

David.

Le 3 avril 2012 à 16:10, Shay Banon \< [kimchy@gmail.com](mailto:kimchy@gmail.com) \> a écrit :

Yea, only the list mentioned in the update settings can be applied  
dynamically, while other settings can be applied on a closed index. The  
number of replicas can be updated on a live index though...

On Sun, Apr 1, 2012 at 10:49 PM, David Pilato \< david@pilato.fr \> wrote:

Hi Shay,

I think I understood where the error came from:

> <https://gist.github.com/dadoonet/2278029>

I cannot update number of replicas on a closed index.

So some properties have to be updated on a closed index and others on a live  
index.

My use case is for the Spring factory.

I want to update settings but I dont know what settings will set the user.

Is there a way to analyze the settings json file and split it in two  
settings files : one to be applied live and another to be applied closed ?

Do you have any class or method in ES that I can use for that ?

Or do I have to parse all the properties to find if one of them is in this  
list :  
[http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settin](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settin)  
gs.html so it has to be applied on a live index ?

Is there any reason that you cant apply all properties on a closed index ?  
Should I raise an issue ?

Thanks

David.

De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto: [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
] De la part de Shay Banon

Envoyé : samedi 31 mars 2012 23:02

À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Objet : Re: Can I update analyzer settings without recreating the index?

Thats strange..., can you gist hte full failure? This works on 0.19:

curl -XPUT localhost:9200/test

curl -XPOST localhost:9200/test/\_close

curl -XPUT localhost:9200/test/\_settings -d '{

```
"index" : {

    "something" : "value"

}

```

}'

On Fri, Mar 30, 2012 at 11:58 PM, David Pilato \< david@pilato.fr \> wrote:

Hi Shay,

Just to be sure to understand this.

If we want to merge settings (replication), we should (must ?) not close the  
index before sending an update settings.

But if we want to add a new analyzer, we must close the index before.

Is that it ?

I tried this in Java :

```
         // Before merging, we have to close the index 

         CloseIndexRequestBuilder cirb = client

```

.admin().indices().prepareClose(index);

```
         CloseIndexResponse closeIndexResponse =

```

cirb.execute().actionGet();

```
         if (!closeIndexResponse.acknowledged()) throw new Exception(

```

"Could not close index [" +index+ "]." );

```
         UpdateSettingsRequestBuilder usrb = client

```

.admin().indices().prepareUpdateSettings(index);

```
         // If there are settings for this index, we use it. If not,

```

using Elasticsearch defaults.

```
         String source = readIndexSettings(index); 

         if (source != null ) { 

                if ( logger .isTraceEnabled()) logger .trace( "Found

```

settings for index " +index+ " : " + source);

```
                usrb.setSettings(source); 

         } 

         

         usrb.execute().actionGet(); 

```

But it failed at the last line with a  
org.elasticsearch.indices.IndexMissingException: [twitter] missing

If I remove the closeIndex lines, I dont get the exception but I get the  
following warning :

22:56:48,843 WARN [metadata] [junit.node.transport] [twitter] ignoring non  
dynamic index level settings for open indices:  
[index.analysis.analyzer.type]

How to close an index and update settings in java ?

Thanks

David.

De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto: [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
] De la part de Shay Banon  
Envoyé : mercredi 28 mars 2012 10:55  
À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Objet : Re: Can I update analyzer settings without recreating the index?

You can't change analyzer config on a "live" index using update settings,  
you can though close the index, send an update settings with the new  
analysis settings, and then open it back, though I am not sure of close/open  
are allowed in bonsai...

On Wed, Mar 28, 2012 at 9:43 AM, Nick Dunn \< nick@nick-dunn.co.uk \> wrote:

I am looking at using a hosted ES service (Bonsai.io) which offers an  
index per customer, pre-created. Usually I create a config file  
containing my custom analyzers and send this when creating an index,  
however because Bonsai provide the index already, this method will not  
work.

I've read the docs for the Updating Settings API for an index but it  
seems only certain settings can be modified this way, and not  
analyzers.

What are my options here? I've not heard of a way to update index  
custom analyzers without recreating an index, but perhaps I've missed  
something somewhere! Can I send custom analyzer config another way?

--  
David Pilato  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet

--  
David Pilato  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet

---

<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:** [July 6, 2017, 3:33am UTC](https://discuss.elastic.co/t/can-i-update-analyzer-settings-without-recreating-the-index/7161/13 "2017-07-06T03:33:34Z")

</div>


