Skip to content

Instantly share code, notes, and snippets.

@jprante
Created May 13, 2014 21:51
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 jprante/042aaa910e47ebf4536b to your computer and use it in GitHub Desktop.
Save jprante/042aaa910e47ebf4536b to your computer and use it in GitHub Desktop.
Filter cache invalidate
curl -XDELETE 'localhost:9200/test'
curl -XPUT 'localhost:9200/test/data/1' -d '
{
"roles": ["admin"]
}
'
curl -XPUT 'localhost:9200/test/data/2' -d '
{
"a": 1,
"role": "admin"
}
'
curl -XGET 'localhost:9200/test/_refresh'
curl -XGET 'localhost:9200/test/_search?pretty' -d '
{
"query": {
"constant_score": {
"filter": {
"terms": {
"roles": [ "admin" ],
"_cache_key": "user_roles"
}
}
}
}
}
'
curl -XPUT 'localhost:9200/test/data/1' -d '
{
"roles": []
}
'
curl -XGET 'localhost:9200/test/_refresh'
curl -XGET 'localhost:9200/test/_search?pretty' -d '
{
"query": {
"constant_score": {
"filter": {
"terms": {
"roles": [ "admin" ],
"_cache_key": "user_roles"
}
}
}
}
}
'
curl -XPOST 'localhost:9200/test/_cache/clear?filter_keys=user_roles'
curl -XGET 'localhost:9200/test/_search?pretty' -d '
{
"query": {
"constant_score": {
"filter": {
"terms": {
"roles": [ "admin" ],
"_cache_key": "user_roles"
}
}
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment