Skip to content

Instantly share code, notes, and snippets.

@radu-gheorghe
Created March 8, 2013 15:04
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 radu-gheorghe/5117021 to your computer and use it in GitHub Desktop.
Save radu-gheorghe/5117021 to your computer and use it in GitHub Desktop.
different TTL for parents and children test. Assumes: $ tail -1 /etc/elasticsearch/elasticsearch.yml indices.ttl.interval: 1s
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/p/_mapping -d '{
"p" :{
"_ttl" : { "enabled" : true, "default": "10s" }
}
}'
curl -XPUT localhost:9200/test/c/_mapping -d '{
"c" :{
"_ttl" : { "enabled" : true, "default": "20s" }
}
}'
curl -XPUT localhost:9200/test/p/1 -d '{"foo":"bar"}'
curl -XPUT 'localhost:9200/test/c/2?parent=1' -d '{"foo":"bar"}'
curl -XPOST localhost:9200/test/_refresh
echo
curl localhost:9200/test/_search?pretty
sleep 5
curl -XPOST localhost:9200/test/_refresh
curl localhost:9200/test/_search?pretty
sleep 10
echo parent should disappear
curl -XPOST localhost:9200/test/_refresh
curl localhost:9200/test/_search?pretty
sleep 10
echo no hits
curl -XPOST localhost:9200/test/_refresh
curl localhost:9200/test/_search?pretty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment