Skip to content

Instantly share code, notes, and snippets.

@imotov
Created May 11, 2011 21:00
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 imotov/967342 to your computer and use it in GitHub Desktop.
Save imotov/967342 to your computer and use it in GitHub Desktop.
curl -XPUT 'http://localhost:9200/twitter/tweet/1?refresh=true' -d '{
"user": "kimchy",
"post_date": "2009-11-15T13:12:00",
"message": "Trying out elasticsearch, so far so good?"
}'
echo ""
curl -XPUT 'http://localhost:9200/twitter/tweet/2?refresh=true' -d '{
"user": "kimchy",
"post_date": "2009-11-15T14:12:12",
"message": "You know, for Search"
}'
echo ""
curl -XPOST 'http://localhost:9200/_aliases' -d '{
"actions" : [
{ "add" : { "index" : "twitter", "alias" : "alias1" } }
]
}'
echo ""
curl -XPOST 'http://localhost:9200/_aliases' -d '{
"actions" : [
{ "add" : { "index" : "twitter", "alias" : "alias2" } }
]
}'
echo ""
curl -XGET 'http://localhost:9200/twitter/tweet/_count?q=user:kimchy'
echo ""
# Returns --> {"count":2,"_shards":{"total":5,"successful":5,"failed":0}}
curl -XGET 'http://localhost:9200/alias1,alias2/tweet/_count?q=user:kimchy'
echo ""
# Returns --> {"count":4,"_shards":{"total":10,"successful":10,"failed":0}}
curl -XGET 'http://localhost:9200/alias1,alias2/tweet/_search?q=user:kimchy&pretty=true'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment