ElasticSearch之Clear cache API

本方法用于清理缓存。

命令样例如下:

curl -X POST "https://localhost:9200/testindex_001/_cache/clear?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"

执行结果的样例,如下:

{
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
}
}

方法参数
fielddata,默认值为false

  • true,清理字段相关的缓存。
  • false,不清理字段的缓存。

fields,默认值为全部字段,否则只清理指定的字段。

ignore_unavailable,默认值为false

  • true,本操作执行时跳过失效或者不可用的index
  • false,本操作执行时,遇到失效或者不可用的index,则报错,样例如下:
    {
    "error" : {
    "root_cause" : [
    {
    "type" : "index_not_found_exception",
    "reason" : "no such index [testindex_002]",
    "resource.type" : "index_or_alias",
    "resource.id" : "testindex_002",
    "index_uuid" : "_na_",
    "index" : "testindex_002"
    }
    ],
    "type" : "index_not_found_exception",
    "reason" : "no such index [testindex_002]",
    "resource.type" : "index_or_alias",
    "resource.id" : "testindex_002",
    "index_uuid" : "_na_",
    "index" : "testindex_002"
    },
    "status" : 404
    }

query,默认值为false

  • true,清理query的缓存。
  • false

request,默认值为false

  • true,清理request的缓存。
  • false

相关资料

posted @   jackieathome  阅读(41)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示