Initially if you just start an elastic search server and try to create
an index you will get 5 shards and 2 replicas (I hope I am not wrong).
How can I configure this? I know that I can send a JSON / Text
initially when I am creating a new index but I don't want every time
when a new index is created to specify the shards/replicas I want
initially to use different values than 5 shards and 2 replicas.
Initially if you just start an Elasticsearch server and try to create
an index you will get 5 shards and 2 replicas (I hope I am not wrong).
How can I configure this? I know that I can send a JSON / Text
initially when I am creating a new index but I don't want every time
when a new index is created to specify the shards/replicas I want
initially to use different values than 5 shards and 2 replicas.
I saw that there is a config folder when you download the standalone
Elasticsearch. And inside this config folder there is a file :
elasticsearch.yml where I can specify these values. This all is great
BUT in my case I am using a standalone server started from a Java
class, like below:
Builder settings = ImmutableSettings.settingsBuilder();
// here you can set the node and index settings via API
settings.build();
NodeBuilder nBuilder = nodeBuilder().settings(settings);
nBuilder.local(true);
// start it!
Node node = nBuilder.build().start();
System.out.println("Started Elastic Search Server");
=====
How can I pass these configuration options, when using the Java API
directly?
Initially if you just start an Elasticsearch server and try to create
an index you will get 5 shards and 2 replicas (I hope I am not wrong).
How can I configure this? I know that I can send a JSON / Text
initially when I am creating a new index but I don't want every time
when a new index is created to specify the shards/replicas I want
initially to use different values than 5 shards and 2 replicas.
On Wednesday, June 1, 2011 at 11:27 AM, paranoiabla wrote:
Ok,
I saw that there is a config folder when you download the standalone
Elasticsearch. And inside this config folder there is a file :
elasticsearch.yml where I can specify these values. This all is great
BUT in my case I am using a standalone server started from a Java
class, like below:
Initially if you just start an Elasticsearch server and try to create
an index you will get 5 shards and 2 replicas (I hope I am not wrong).
How can I configure this? I know that I can send a JSON / Text
initially when I am creating a new index but I don't want every time
when a new index is created to specify the shards/replicas I want
initially to use different values than 5 shards and 2 replicas.
From node.settings() I can only read the settings values but I cannot
change them - there are only getter methods. Can you show a snippet -
maybe I don't understanding correctly.
On Wednesday, June 1, 2011 at 11:27 AM, paranoiabla wrote:
Ok,
I saw that there is a config folder when you download the standalone
Elasticsearch. And inside this config folder there is a file :
elasticsearch.yml where I can specify these values. This all is great
BUT in my case I am using a standalone server started from a Java
class, like below:
Initially if you just start an Elasticsearch server and try to create
an index you will get 5 shards and 2 replicas (I hope I am not wrong).
How can I configure this? I know that I can send a JSON / Text
initially when I am creating a new index but I don't want every time
when a new index is created to specify the shards/replicas I want
initially to use different values than 5 shards and 2 replicas.
Its already in your code (the comment you have), I added a sample:
Builder settings = ImmutableSettings.settingsBuilder();
// here you can set the node and index settings via API
settings.put("index.number_of_shards", 1);
settings.build();
On Wednesday, June 1, 2011 at 4:56 PM, paranoiabla wrote:
Hi Shay,
From node.settings() I can only read the settings values but I cannot
change them - there are only getter methods. Can you show a snippet -
maybe I don't understanding correctly.
On Wednesday, June 1, 2011 at 11:27 AM, paranoiabla wrote:
Ok,
I saw that there is a config folder when you download the standalone
Elasticsearch. And inside this config folder there is a file :
elasticsearch.yml where I can specify these values. This all is great
BUT in my case I am using a standalone server started from a Java
class, like below:
Initially if you just start an Elasticsearch server and try to create
an index you will get 5 shards and 2 replicas (I hope I am not wrong).
How can I configure this? I know that I can send a JSON / Text
initially when I am creating a new index but I don't want every time
when a new index is created to specify the shards/replicas I want
initially to use different values than 5 shards and 2 replicas.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.