Skip to content

Instantly share code, notes, and snippets.

@Lothiraldan
Last active December 16, 2015 19:59
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 Lothiraldan/5488931 to your computer and use it in GitHub Desktop.
Save Lothiraldan/5488931 to your computer and use it in GitHub Desktop.
Timing issue with aliases and index status
{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}
[u'test.1.1']
[u'test.1.1']
{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}
[u'test.1.2']
[u'test.1.2']
{"ok":true,"acknowledged":true}%
curl -XPUT 'http://localhost:9200/test.1.1'
curl -XPOST 'http://localhost:9200/_aliases' -d '
{
"actions" : [
{ "add" : { "index" : "test.1.1", "alias" : "test.write" } }
]
}'
curl -XPOST 'http://localhost:9200/_aliases' -d '
{
"actions" : [
{ "add" : { "index" : "test.1.1", "alias" : "test.read" } }
]
}'
curl -XGET 'localhost:9200/test.write/_status' | python -c "import json; import sys; x = json.load(sys.stdin); print x['indices'].keys()"
curl -XGET 'localhost:9200/test.read/_status' | python -c "import json; import sys; x = json.load(sys.stdin); print x['indices'].keys()"
curl -XPUT 'http://localhost:9200/test.1.2'
curl -XPOST 'http://localhost:9200/_aliases' -d '
{
"actions" : [
{ "remove" : { "index" : "test.1.1", "alias" : "test.write" } },
{ "add" : { "index" : "test.1.2", "alias" : "test.write" } }
]
}'
curl -XPOST 'http://localhost:9200/_aliases' -d '
{
"actions" : [
{ "remove" : { "index" : "test.1.1", "alias" : "test.read" } },
{ "add" : { "index" : "test.1.2", "alias" : "test.read" } }
]
}'
curl -XGET 'localhost:9200/test.write/_status' | python -c "import json; import sys; x = json.load(sys.stdin); print x['indices'].keys()"
curl -XGET 'localhost:9200/test.read/_status' | python -c "import json; import sys; x = json.load(sys.stdin); print x['indices'].keys()"
curl -XDELETE 'http://localhost:9200/_all'
./test_es.sh
{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}
[u'test.1.1']
[u'test.1.1']
{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}
[]
[]
{"ok":true,"acknowledged":true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment