Elasticsearch: Update Settings API: Allow to dynamically change the number of replicas

Created on 8 Aug 2010  Â·  8Comments  Â·  Source: elastic/elasticsearch

A new API, update index / indices settings, allowing to change specific index level settings. The first setting supported is the index.number_of_replicas setting allowing to dynamically change the number of replicas an index has.

The REST endpoint is /_settings (to update all indices) or {index}/_settings to update one (or more) indices settings. The body of the request includes the updated settings, for example:

{
    "index" : {
        "number_of_replicas" : 4
    }
}

The above will change the number of replicas to 4 from the current number of replicas. Here is a curl example:

curl -XPUT 'localhost:9200/my_index/_settings' -d '
{
    "index" : {
        "number_of_replicas" : 4
    }
}
'
>feature v0.10.0

All 8 comments

implements.

Nice! So when the number of replicas is increased, what happens? e.g.

  • Does ES start copying indices from master node to additional nodes?
  • Does replication start immediately?
  • Can one throttle the replication speed? (because sudden network and disk IO will affect query throughput)
  • Can one reduce the number or replicas?
  • In case of replica reduction, do indices get physically removed from disk?

Thanks.

  • Indices are not copied from the master node, they are recovered from a primary shard that is allocated "somewhere" in the cluster.
  • Yes.
  • There is built in throttling to not perform recovery from / to many shards at the same time.
  • Yes.
  • Yes.

Btw, this isn't in the ES docs yet

Could you please tell how can we change index replica using java code???
I have done it through curl request but stuck while doing it through java code

@ayush21792 you can find plenty of examples of using java API in elasticsearch integration tests. Saying that, the best place to ask questions like these is elasticsearch mailing list. We are trying to use github issues to track bugs and feature requests.

Thank you so much....
Could you please help me on another issue..When I index very large data of
12.7 million records,my elastic search server is terminating after 8.3
million records and showing the error of java heap memory overflow and the
error persists even after increasing memory.I am using 2gb java heap memory
and have also tried for 1gb and 3gb but result is same(halting at 8.3
million records).I have tried with both java api and es server both are
giving the same result.I am using windows 7.So could u please help me if
there is any setting which i am ignoring.

Thank You

On Fri, Oct 31, 2014 at 5:14 PM, Igor Motov [email protected]
wrote:

@ayush21792 https://github.com/ayush21792 you can find plenty of
examples of using java API in elasticsearch integration tests
https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/indices/settings/UpdateNumberOfReplicasTests.java#L75.
Saying that, the best place to ask questions like these is elasticsearch
mailing list. We are trying to use github issues to track bugs and feature
requests.

—
Reply to this email directly or view it on GitHub
https://github.com/elasticsearch/elasticsearch/issues/302#issuecomment-61249220
.

Ayush Gupta would like to connect on LinkedIn. How would you like to respond?

Accept: https://www.linkedin.com/blink?simpleRedirect=0SejoPcjoTe3AVcP0PdP8UdzARfkh9rCZFt65QqnpKqioTmloRmk9fqjRVpkJApn9xq7cCej5vs7xBnTpKqjRHpipOpmhKqmRBsyRQs6lzoS4JoyRDtCVFnSRJrScJr6RBfmtKqmJzon9Q9ClQqnpKimtBkClOs3Rx9CoJrmFxpCYTdCAJu6hUsC9EbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5968273076624846849_500&markAsRead=

View Ayush Gupta's profile: https://www.linkedin.com/blink?simpleRedirect=ej5vs7xBnTpKqjRHpipOpmhKqmRBsyRQs6lzoS4JoyRDtCVFnSRJrScJr6RBfmtKqmJzon9Q9DpMrzRQ9CoJrmFxpCYTdCAJu6hUsC9EbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5968273076624846849_500&markAsRead=

You are receiving Reminder emails for pending invitations. Unsubscribe here: https://www.linkedin.com/blink?simpleRedirect=1JrSd5cylytmxQqmt5cylVr71Bsz0Q9j8ScjwOd3AJd38Qe6pzcjlApCdAojkVe3oNdj1Ae3sRojxxe6kOdjhzczdBe6oTciQMczcOdP8Jqk8O9nBIs6lOfmNFomRB9z0Sc30OfmhF9zoVdzcNdzsUejAPc3cTczwSejkZp6BD9zANnT1UplZSrCAZqSkCoDlPrDkJpyRzoClJnSRJrScJr6RBfmtKqmJzon9Q9CZLpPRQ9CoJrmFxpCYTdCAJu6hUsC9EbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5968273076624846849_500&markAsRead=

You received an invitation to connect. LinkedIn will use your email address to make suggestions to our members in features like People You May Know. Unsubscribe here: https://www.linkedin.com/blink?simpleRedirect=1CbmRGompLdPpFbnxAu79yq2QZp6BB9ztAi6sQejoQh71ydkkVdQJIjlBNoTcTgnBes5hds7pFqlFvlnx1gQhIe6wJm39KjzsPdngRpjxjgmpScllRiPBOpS8Sum8UjPlIukpUciReojdMoT1xjRFarll7tD5Jhm5zi7B9qBd5rmVeu7dHh3xek4lkmB9ejBhVsSMVk3xmiARzh4VorPtGozhUkDllgk51gmhbtmQPh6RqcjB8kk4Zp6BLr2oVclZMu6lvtCVFfmJB9B4ScSh5hSxmhD9JhB51fmVBqSZkp6BJ9CVRr3RQ9CoJrmFxpCYTdCAJu6hUsC9EbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5968273076624846849_500&markAsRead= Learn why we included this at the following link: https://www.linkedin.com/blink?simpleRedirect=0Ue3sQfmh9pmNzqnhOoioVclZMu6lvtCVFfmJB9CNOlmlzqnpOpldOpmRLt7dRoPRx9CoJrmFxpCYTdCAJu6hUsC9EbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5968273076624846849_500&markAsRead=
© 2014, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043, USA

Was this page helpful?
4 / 5 - 1 ratings