Created
May 11, 2011 21:00
-
-
Save imotov/967342 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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