Warming up
Sometimes, there may be a need to prepare Elasticsearch to handle your queries. Maybe it's because you heavily rely on the field data cache and you want it to be loaded before your production queries arrive, or maybe you want to warm up your operating system's I/O cache so that the data indices files are read from the cache. Whatever the reason, Elasticsearch allows us to use so called warming queries for our types and indices.
Defining a new warming query
A warming query is nothing more than the usual query stored in a special type called _warmer
in Elasticsearch. Let's assume that we have the following query that we want to use for warming up:
curl -XGET localhost:9200/library/_search?pretty -d '{ "query" : { "match_all" : {} },
Get Elasticsearch Server - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.