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 中国社区官方博客3 天前
Elastic 在 AWS re:Invent:总结一年在 agentic AI 创新中的合作
大数据·人工智能·elasticsearch·搜索引擎·云计算·全文检索·aws
在云上(oncloudai)3 天前
用 AWS Firehose 简化日志与事件数据的采集与存储
云计算·aws
weixin_307779133 天前
基于AWS Shield Advanced的自我管理DNS服务DDoS防护方案
网络安全·云计算·aws
习惯就好zz3 天前
在安卓设备上测试 AWS S3 下载速度的完整指南
android·aws·速度测试
长路 ㅤ   4 天前
ES理论:分页查询方案及优化策略
es·scroll·search_after·elasticsearch分页·from+size·pit
bug制造生产者5 天前
AWS的S3上傳
云计算·aws
Allen正心正念20255 天前
AWS专家Greg Coquillo提出的8层Agentic AI架构分析
人工智能·架构·aws
尾张大7 天前
ubuntu AWS 磁盘扩容
运维·aws
围炉聊科技9 天前
尝鲜 AWS Agentic IDE:Kiro 一周使用初体验
ide·人工智能·ai编程·aws
翼龙云_cloud10 天前
亚马逊云渠道商:新手怎么利用AWS Lightsail部署 WordPress?
运维·服务器·云计算·aws