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
相关推荐
AWS官方合作商1 天前
零性能妥协:Gearbox Entertainment 通过 AWS 和 Perforce 实现远程开发革命
大数据·云计算·aws
无责任此方_修行中4 天前
从 HTTP 轮询到 MQTT:我们在 AWS IoT Core 上的架构演进与实战复盘
后端·架构·aws
weixin_307779136 天前
AWS Lambda解压缩S3 ZIP文件流程
python·算法·云计算·aws
在云上(oncloudai)10 天前
AWS KMS VS AWS Cloud HSM VS AWS Secret Manager?
云计算·aws
大斯斯10 天前
AWS 亚马逊云预警通知接入钉钉告警(微信同样适用)
aws
大斯斯10 天前
AWS 通过 CloudWatch 实现应用日志告警
aws
指剑14 天前
借助Rclone快速从阿里云OSS迁移到AWS S3
阿里云·云计算·迁移学习·aws·亚马逊云科技·rclone
huainian14 天前
AWS 云小白学习指南 (一)
云计算·aws
xybDIY14 天前
智能云探索:基于Amazon Bedrock与MCP Server的AWS资源AI运维实践
运维·人工智能·aws