Skip to content

Instantly share code, notes, and snippets.

@imotov
Created January 17, 2013 02:58
Show Gist options
  • Save imotov/4553146 to your computer and use it in GitHub Desktop.
Save imotov/4553146 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
},
"mappings": {
"doc": {
"_timestamp" : { "enabled" : true }
}
}
}'
curl -XPUT localhost:9200/test/doc/1 -d '{"foo": "1"}'
sleep 1
curl -XPUT localhost:9200/test/doc/2 -d '{"foo": "2"}'
sleep 1
curl -XPUT localhost:9200/test/doc/3 -d '{"foo": "3"}'
sleep 1
curl -XPOST localhost:9200/test/_refresh
echo
curl "localhost:9200/test/doc/_search?sort=_timestamp&pretty=true&fields=foo"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment