Skip to content

Instantly share code, notes, and snippets.

@up1
Last active August 29, 2015 14:07
Show Gist options
  • Save up1/cf60c49220264a7d14a7 to your computer and use it in GitHub Desktop.
Save up1/cf60c49220264a7d14a7 to your computer and use it in GitHub Desktop.
Demo :: Zero downtime on Elasticsearch
$curl -XPOST http://localhost:9200/demo/post/1
{
"author": "Somkiat",
"title": "My first post"
}
$curl -XGET http://localhost:9200/demo/_mapping?pretty
{
"demo" : {
"mappings" : {
"post" : {
"properties" : {
"author" : {
"type" : "string"
},
"title" : {
"type" : "string"
}
}
}
}
}
}
$curl -XPOST http://localhost:9200/demo/post/2
{
"Author": "Prathan",
"Title": "My second post"
}
$curl -XGET http://localhost:9200/demo/_mapping?pretty
{
"demo" : {
"mappings" : {
"post" : {
"properties" : {
"Author" : {
"type" : "string"
},
"Title" : {
"type" : "string"
},
"author" : {
"type" : "string"
},
"title" : {
"type" : "string"
}
}
}
}
}
}
$curl -XGET http://localhost:9200/new_demo/
{
"mappings" : {
"post" : {
"properties" : {
"Author" : {
"type" : "string"
},
"Title" : {
"type" : "string"
}
}
}
}
}
curl -XPOST localhost:9200/_aliases -d
{
"actions": [
{ "add": {
"alias": "xxxxx",
"index": "demo"
}}
]
}
curl -XPOST localhost:9200/_aliases -d
{
"actions": [
{ "remove": {
"alias": "xxxxx",
"index": "demo"
}},
{ "add": {
"alias": "xxxxx",
"index": "new_demo"
}}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment