?
# 創建通用索引模版
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/_countGET /aws-waf-logs----2025-07-08/_mappingPOST /aws-waf-logs----2025-07-08/_refreshPOST /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