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 中国社区官方博客5 天前
Elastic 公共 roadmap 在此
大数据·elasticsearch·ai·云原生·serverless·全文检索·aws
TG_yunshuguoji5 天前
亚马逊云代理商:AWS 国际站缺卡新用户创建邮箱怎么选择?
安全·云计算·aws
TG_yunshuguoji6 天前
亚马逊云代理商:如何监控AWS RDS使用率并设置报警?
运维·云计算·aws
翼龙云_cloud6 天前
亚马逊云代理商:如何在 AWS 控制台上手动重启主实例?
服务器·云计算·aws
没有bug.的程序员6 天前
云服务成本优化深度进阶:AWS/Aliyun 资源监控内核、自动伸缩物理建模与 FinOps 降本实战指南
云计算·aws·finops·aliyun·自动伸缩·资源监控·物理建模
Elastic 中国社区官方博客8 天前
推出 Elastic Serverless Plus 附加组件,支持 AWS PrivateLink 功能
大数据·elasticsearch·搜索引擎·云原生·serverless·全文检索·aws
Johnny.Cheung9 天前
MLOps是什么?AWS-Azure-GCP
llm·azure·aws·mlops·gcp
sun032211 天前
【AWS】【服务】aws 中的各种服务 ,比如 ECS、S3 、EC2 、 Certicicate Manager、CloudWatch等
云计算·aws
sun032213 天前
【AWS】【ECS】部署流程
云计算·aws
七夜zippoe14 天前
分布式系统弹性设计实战:Hystrix与Sentinel熔断降级深度解析
java·hystrix·sentinel·aws·分布式系统