elasticsearch之缓存清除策略

来源:互联网 发布:最诡异的事情 知乎 编辑:程序博客网 时间:2024/06/08 13:34
前面提及了字段过滤缓存,那么与之相反的清楚缓存策略
单一索引缓存,多索引缓存和全部缓存的清理

1.清空全部缓存
curl localhost:9200/_cache/clear?pretty
{
  "_shards" : {
    "total" : 72,
    "successful" : 72,
    "failed" : 0
  }
}

2.清除单一索引缓存
curl localhost:9200/index/_cache/clear?pretty
{
  "_shards" : {
    "total" : 2,
    "successful" : 2,
    "failed" : 0
  }
}

3.清除多索引缓存
curl localhost:9200/index1,index2,index3/_cache/clear?pretty
{
  "_shards" : {
    "total" : 12,
    "successful" : 12,
    "failed" : 0
  }
}
当然了清楚缓存时也可以添加参数使之清楚对用的缓存并非所有的
filter:此类缓存可以设置filter参数为true来清理,相反的不需要清楚此类缓存那么可以设置参数为false来保留此类缓存
field_data:此类缓存可以设置filter参数为true来清理,相反的不需要清楚此类缓存那么可以设置参数为false来保留此类缓存
bloom:此类缓存可以设置filter参数为true来清理(如果某种倒排索引格式中引用了bloom filter则可能使用此类缓存),相反的不需要清楚此类缓存那么可以设置参数为false来保留此类缓存
fields:清楚字段相关的缓存,可以为单个或者多个字段,多个字段的时候用逗号隔开(英文)

上述参数使用格式(可以使用一个或者多个参数)
curl localhost:9200/index/_cache/clear?pretty&filter=false&field_data=true&bloom=false&fields=tag,name

原创粉丝点击