Skip to content

Instantly share code, notes, and snippets.

@imotov
Created March 26, 2013 02:49
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/5242738 to your computer and use it in GitHub Desktop.
Save imotov/5242738 to your computer and use it in GitHub Desktop.
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
}
}
'
curl -XPOST localhost:9200/test/doc/1 -d '{
"foo": 1,
"bar": 0
}
'
curl -XPOST localhost:9200/test/doc/2 -d '{
"foo": 2,
"bar": 1
}
'
curl -XPOST localhost:9200/test/doc/3 -d '{
"foo": 3,
"bar": 0
}
'
curl -XPOST localhost:9200/test/doc/4 -d '{
"foo": 4,
"bar": 1
}
'
curl -XPOST localhost:9200/test/doc/5 -d '{
"foo": 5,
"bar": 0
}
'
curl -XPOST 'http://localhost:9200/_aliases' -d '
{
"actions" : [
{
"add" : {
"index" : "test",
"alias" : "odd_alias",
"filter" : { "term" : { "bar" : 1 } }
}
}
]
}'
curl -X POST 'http://localhost:9200/test/_refresh'
echo
curl -X GET 'http://localhost:9200/odd_alias/doc/_search?pretty' -d '{
"query": {
"match_all": {}
},
"fields": []
}'
echo
curl -X GET 'http://localhost:9200/odd_alias/doc/_search?pretty' -d '{
"query": {
"match_all": {}
},
"sort": {
"foo" : {
"order": "asc"
}
},
"fields": []
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment