elasticsearchelasticsearch-2.0

Having trouble starting elasticsearch-2.0


I have recently run into an issue where I am not able to start elasticsearch.

Version-2.0 OS: Linux

An error message was displayed

    [ERROR][gateway                  ] [Node] failed to read local state, exiting...
    ElasticsearchException[must specify numberOfShards for index [version]]; nested: IllegalArgumentException[must specify numberOfShards for index [version]];
at org.elasticsearch.ExceptionsHelper.maybeThrowRuntimeAndSuppress(ExceptionsHelper.java:163)
        at org.elasticsearch.gateway.MetaDataStateFormat.loadLatestState(MetaDataStateFormat.java:309)
        at org.elasticsearch.gateway.MetaStateService.loadIndexState(MetaStateService.java:112)
        at org.elasticsearch.gateway.MetaStateService.loadFullState(MetaStateService.java:97)
        at org.elasticsearch.gateway.GatewayMetaState.loadMetaState(GatewayMetaState.java:97)
        at org.elasticsearch.gateway.GatewayMetaState.pre20Upgrade(GatewayMetaState.java:223)
        at org.elasticsearch.gateway.GatewayMetaState.<init>(GatewayMetaState.java:85)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:56)

How to start the elasticsearch?

Edit 01:

I have put the shards and replicas in the elasticsearch.yml files but still not able to start elasticsearch. Getting the above error message.

Edit 02:

I have added the shards to the yml file.

#################################### Index ####################################

# You can set a number of options (such as shard/replica options, mapping
# or analyzer definitions, translog settings, ...) for indices globally,
# in this file.
#
# Note, that it makes more sense to configure index settings specifically for
# a certain index, either when creating it or by using the index templates API.
#
# See <http://elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules.html> and
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html>
# for more information.

# Set the number of shards (splits) of an index (5 by default):
#
index.number_of_shards: 2

# Set the number of replicas (additional copies) of an index (1 by default):
#
index.number_of_replicas: 1

Solution

  • We went ahead and restored the server to the prior date when elasticsearch was working , and the issue was resolved.