AWS OpenSearch Dev Tools使用

bash 复制代码
# 创建通用索引模版
PUT _template/aws-waf_logs_template
{
    "index_patterns": ["aws-waf-logs-*"],
    "mappings": {
        "properties": {
            "timestamp": {
                "type": "date"
            }
        }
    }
}

# 设置单个索引格式
PUT /aws-waf-logs-k2025-07-08
{
  "mappings": {
    "properties": {
      "timestamp": {
        "type": "date",
        "format": "yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"
      }
    }
  }
}

# 将旧的索引替换为新的索引,主要用来修改格式
POST /_reindex
{
  "source": {
    "index": "aws-waf-logs-2025-07-08"
  },
  "dest": {
    "index": "aws-waf-logs-k2025-07-08"
  }
}

# 查看是否生效
GET /aws-waf-logs----2025-07-08/_search
{
  "size": 10
}

# 查看是否生效
GET /aws-waf-logs----2025-07-08/_count

GET /aws-waf-logs----2025-07-08/_mapping

POST /aws-waf-logs----2025-07-08/_refresh

POST /aws-waf-logs----2025-07-08/_cache/clear

#使用 Dev Tools 清除缓存:

#在 OpenSearch Dashboards 中,打开 Dev Tools(开发者工具)。
#1. 运行以下命令以清除索引缓存:
POST /your-index-name/_cache/clear
#替换 your-index-name 为你的索引名称。

#2. 清除索引缓存
#如果你想要清除特定索引的缓存,可以使用以下命令:
POST /your-index-name/_cache/clear

#3. 清除集群缓存
#如果你需要清除整个集群的缓存,可以使用以下命令:
POST /_cache/clear

#4. 清除搜索缓存
#如果你想要清除搜索缓存,可以使用以下命令:
POST /your-index-name/_search/clear_cache

#5. 清除字段缓存
#如果你在使用聚合时遇到问题,可能需要清除字段缓存:
POST /your-index-name/_field/data/clear

#6. 查看集群状态
GET _cluster/health
相关推荐
Elastic 中国社区官方博客1 天前
AWS 自动化根因分析:从 CloudWatch 告警到完成故障诊断,仅需 36 秒
大数据·运维·elasticsearch·自动化·aws
范桂飓2 天前
AWS Strands Agents 技术解析
人工智能·云计算·aws
deepseek235 天前
硬预算帽默认值拆解:AWS 九月上线支出上限、GCP 七月跟进,Agent 时代按量付费必须默认断供
人工智能·llm·云计算·agent·aws
johnny2337 天前
AWS系列之Glue
aws
范桂飓8 天前
AWS Agent Infra 架构分析
java·架构·aws
johnny2339 天前
本地AWS云栈工具LocalStack:简介、原理、实战
aws
johnny2339 天前
AWS系列之官方CLI、AWS Local:简介、实战
aws
weixin_4764707711 天前
ELK 平台部署操作手册(9.4)
es
骑着蜗牛撵大象32719 天前
微信远程指挥电脑:用Hermes Agent构建本地AI执行引擎实战指南
机器人·自动化·es
骑着蜗牛撵大象32719 天前
从跨平台Linux到鸿蒙PC:基于Qt C++的Flameshot截图工具源码级适配
harmonyos·鸿蒙·es