Tuesday, May 1, 2018

Elastic Search Example: Part 4

Donghuas-MacBook-Air:elasticsearch-6.2.4 donghua$ curl -XGET  -u elastic:elastic 'localhost:9200/_cat/indices/blogs?v'
health status index uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   blogs NWKFGM2GQe-fS481ZI7EuA   5   1          3            0     16.4kb         16.4kb

Donghuas-MacBook-Air:elasticsearch-6.2.4 donghua$ curl -XGET  -u elastic:elastic 'localhost:9200/blogs/_settings?pretty'
{
  "blogs" : {
    "settings" : {
      "index" : {
        "creation_date" : "1525127903277",
        "number_of_shards" : "5",
        "number_of_replicas" : "1",
        "uuid" : "NWKFGM2GQe-fS481ZI7EuA",
        "version" : {
          "created" : "6020499"
        },
        "provided_name" : "blogs"
      }
    }
  }
}

Donghuas-MacBook-Air:elasticsearch-6.2.4 donghua$ curl -XPUT  -H 'Content-Type: application/json' -u elastic:elastic 'localhost:9200/blogs/_settings?pretty' -d '{
>   "index" : {
>     "number_of_replicas" : 0
>   }
> }'
{
  "acknowledged" : true
}

Donghuas-MacBook-Air:elasticsearch-6.2.4 donghua$ curl -XGET  -u elastic:elastic 'localhost:9200/blogs/_settings?pretty'
{
  "blogs" : {
    "settings" : {
      "index" : {
        "creation_date" : "1525127903277",
        "number_of_shards" : "5",
        "number_of_replicas" : "0",
        "uuid" : "NWKFGM2GQe-fS481ZI7EuA",
        "version" : {
          "created" : "6020499"
        },
        "provided_name" : "blogs"
      }
    }
  }
}
Donghuas-MacBook-Air:elasticsearch-6.2.4 donghua$ curl -XGET  -u elastic:elastic 'localhost:9200/_cat/indices/blogs?v'
health status index uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   blogs NWKFGM2GQe-fS481ZI7EuA   5   0          3            0     16.4kb         16.4kb
Donghuas-MacBook-Air:elasticsearch-6.2.4 donghua$ 


Symptoms if "index.number_of_replicas: 0" in "config/elasticsearch.yml"

Found index level settings on node level configuration.

Since elasticsearch 5.x index level settings can NOT be set on the nodes 
configuration like the elasticsearch.yaml, in system properties or command line 
arguments.In order to upgrade all indices the settings must be updated via the 
/${index}/_settings API. Unless all settings are dynamic all indices must be closed 
in order to apply the upgradeIndices created in the future should use index templates 
to set default values. 

Please ensure all required values are updated on all indices by executing: 

curl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -d '{
  "index.number_of_replicas" : "0"
}'
*************************************************************************************

[2018-05-01T08:21:55,016][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: node settings must not contain any index level settings
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.4.jar:6.2.4]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.2.4.jar:6.2.4]
Caused by: java.lang.IllegalArgumentException: node settings must not contain any index level settings
at org.elasticsearch.common.settings.SettingsModule.(SettingsModule.java:128) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.node.Node.(Node.java:331) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.node.Node.(Node.java:246) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.4.jar:6.2.4]

... 6 more

No comments:

Post a Comment