Created
May 15, 2013 19:55
-
-
Save dadoonet/5586855 to your computer and use it in GitHub Desktop.
Delete By Query usage
This file contains hidden or 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
echo "clean index" | |
curl -XDELETE 'http://localhost:9200/twitter?pretty' ; echo | |
echo "PUT Tweet" | |
curl -XPUT 'http://localhost:9200/twitter/tweet/1?ttl=1h&pretty' -d ' | |
{ | |
"created_at": "Mon May 13 19:59:27 +0000 2013" | |
} | |
' ; echo | |
# Refresh docs | |
echo "Refresh index" | |
curl -XPOST 'http://localhost:9200/twitter/_refresh?pretty' ; echo | |
echo "Search" | |
curl -XGET 'http://localhost:9200/twitter/tweet/_search?pretty' -d ' | |
{ "query" : { | |
"filtered": { | |
"query": {"match_all": {}}, | |
"filter": {"range": { | |
"created_at": { | |
"lt": "now-1h" | |
} | |
}} | |
} | |
} | |
}' ; echo | |
echo "Delete by same query" | |
curl -XDELETE 'http://localhost:9200/twitter/tweet/_query?pretty' -d ' | |
{ | |
"filtered": { | |
"query": {"match_all": {}}, | |
"filter": {"range": { | |
"created_at": { | |
"lt": "now-1h" | |
} | |
}} | |
} | |
}' ; echo | |
# Refresh docs | |
echo "Refresh index" | |
curl -XPOST 'http://localhost:9200/twitter/_refresh?pretty' ; echo | |
echo "Search" | |
curl -XGET 'http://localhost:9200/twitter/tweet/_search?pretty' -d ' | |
{ "query" : { | |
"filtered": { | |
"query": {"match_all": {}}, | |
"filter": {"range": { | |
"created_at": { | |
"lt": "now-1h" | |
} | |
}} | |
} | |
} | |
}' ; echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment