-
-
Save ppf2/bfa38b8284e09c0740ad to your computer and use it in GitHub Desktop.
query cache test
This file contains 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
DELETE /shardcache | |
PUT /shardcache | |
{ | |
"settings": { | |
"index.cache.query.enable": true | |
} | |
} | |
GET /shardcache/_settings | |
POST /shardcache/type/1 | |
{ | |
"tweet":"Obama", | |
"created_at":"2012-01-01T00:00:00Z", | |
"created_at2":"2012-01-01T00:00:00Z" | |
} | |
POST /shardcache/type/2 | |
{ | |
"tweet":"Obama", | |
"created_at":"2016-01-01T00:00:00Z", | |
"created_at2":"2012-01-01T00:00:00Z" | |
} | |
POST shardcache/_cache/clear | |
GET _nodes/stats?pretty | |
# at this point query cache is empty | |
# run this | |
GET /shardcache/_search?search_type=count | |
{ | |
"query": { | |
"filtered": { | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"range": { | |
"created_at2": { | |
"gte": "2012-01-01T00:00:00Z", | |
"lte": "2016-01-01T00:00:00Z" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
"aggs": { | |
"tweets_per_day": { | |
"date_histogram": { | |
"field": "created_at", | |
"interval": "day" | |
} | |
} | |
} | |
} | |
# still nothing in cache | |
GET _nodes/stats?pretty | |
# run this | |
GET /shardcache/_search?search_type=count | |
{ | |
"aggs": { | |
"tweets_per_day": { | |
"date_histogram": { | |
"field": "created_at", | |
"interval": "day" | |
} | |
} | |
} | |
} | |
# now there is something in the cache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment