Skip to content

Instantly share code, notes, and snippets.

@creg
Created December 3, 2013 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creg/7775457 to your computer and use it in GitHub Desktop.
Save creg/7775457 to your computer and use it in GitHub Desktop.
Repro UnavailableShardsException when number of replicas greater than number of nodes
# clean up test index
curl -XDELETE "http://localhost:9200/toomanyreplicas"
# create index
curl -XPOST "http://localhost:9200/toomanyreplicas" -d '
{
"index" : {
"analysis" : {
"analyzer" : {
"language_analyzer" : {
"type" : "snowball",
"language" : "English"
}
}
},
"number_of_shards": 5,
"number_of_replicas": 2
}
}
'
#create mapping
curl -XPOST "http://localhost:9200/toomanyreplicas/Document/_mapping" -d '
{
"Document": {
"_source": {
"compress": false,
"excludes": [
"fileAttachment"
]
},
"properties": {
"fileAttachment": {
"type": "attachment",
"path": "full",
"fields": {
"fileAttachment": {
"type": "string",
"term_vector": "with_positions_offsets",
"index_analyzer": "language_analyzer",
"search_analyzer": "language_analyzer"
},
"author": {
"type": "string",
"store": true
},
"title": {
"type": "string",
"store": true,
"index_analyzer": "language_analyzer"
},
"name": {
"type": "string"
},
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"keywords": {
"type": "string"
},
"content_type": {
"type": "string",
"store": true
},
"content_length": {
"type": "integer"
}
}
},
"id": {
"type": "string"
},
"currentVersionId": {
"type": "string"
}
}
}
}
'
# Attempt to index the document
curl -XPOST "http://localhost:9200/toomanyreplicas/testdocument" -d '
{
"fileAttachment" : "ZmlnaHRpbmc="
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment