English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Elasticsearch 冻结索引

Frequently searched indexes are stored in memory because it takes time to rebuild the index and help with efficient search. On the other hand, there may be indexes that we rarely access. These indexes do not need to occupy memory and can be rebuilt as needed. Such indexes are called frozen indexes.

Each time a search shard is executed, Elasticsearch builds a transient data structure for each shard of the frozen index and immediately discards these data structures after the search is completed. Since Elasticsearch does not maintain these temporary data structures in memory, the frozen index consumes much less heap than a normal index. Compared with other methods, this allows a higher disk-to-heap ratio.

Example of freezing and unfreezing

The following examples show how to freeze and unfreeze indexes-

POST /index_name/_freeze
POST /index_name/_unfreeze

The search on the frozen index is expected to be slow. The frozen index is not suitable for high search loads. Even if the search on the unfrozen index is completed within a few milliseconds, the search on the frozen index may take several seconds or even minutes to complete.

搜索冻结索引

每个节点的并发加载的冻结索引数受search_throttled线程池中的线程数限制,默认情况下为1。要包含冻结索引,必须使用查询参数− ignore_throttled = false来执行搜索请求

GET /index_name/_search?q=user:tpoint&ignore_throttled=false

监视冻结的索引

冻结索引是通过使用搜索限制和内存有效分片实现的普通索引。

GET /_cat/indices/index_name?v&h=i,sth