Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of number_of_shards and number_of_replicas request to reject illegal number #7495

Closed
johtani opened this Issue Aug 28, 2014 · 0 comments

Comments

Projects
None yet
3 participants
@johtani
Copy link
Member

johtani commented Aug 28, 2014

If create an index the following settings, elasticsearch success to create an index.
However, when we create a document, we have error.
There are servral errors.

set 0 to number_of_shards

setting and create a document

curl -XPUT "http://localhost:9200/hoge" -d'
{
  "settings": {
    "number_of_shards": 0
  }
}'

curl -XPUT "http://localhost:9200/hoge/fuga/1" -d'{  "title": "fuga"}'

erorr

{
   "error": "ArithmeticException[/ by zero]",
   "status": 500
}

set -2 to number_of_shards

setting and create adocument

curl -XPUT "http://localhost:9200/hoge" -d'
{
  "settings": {
    "number_of_shards": -2
  }
}'

curl -XPUT "http://localhost:9200/hoge/fuga/1" -d'{  "title": "fuga"}'

error

{
   "error": "IndexShardMissingException[[hoge][0] missing]",
   "status": 404
}

set -2 to number_of_replicas

setting and create a document

curl -XPUT "http://localhost:9200/hoge" -d'
{
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": -2
  }
}'

curl -XPUT "http://localhost:9200/hoge/fuga/1" -d'{  "title": "fuga"}'

error

{
   "error": "UnavailableShardsException[[hoge][0] [0] shardIt, [0] active : Timeout waiting for [1m], request: index {[hoge][fuga][1], source[{\n  \"title\": \"fuga\"\n}\n]}]",
   "status": 503
}

Elasticsearch should return error message and should not create an index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.