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
相关推荐
倒流时光三十年14 小时前
第三阶段 29 · suggester 自动补全(搜索框联想 / 拼写纠错)
es
倒流时光三十年1 天前
第三阶段 24 · filter / filters 桶聚合
es
倒流时光三十年2 天前
第二阶段 17 · multi_match 多字段匹配
es
倒流时光三十年2 天前
第三阶段 23 · 嵌套与子聚合 / top_hits
es
倒流时光三十年2 天前
第二阶段 19 · _source 字段裁剪
es
国际云,接待3 天前
AWS RDS 备份与 PITR 恢复演练:从保留期、恢复命令到应用切换验证
运维·云计算·aws·灾难恢复·数据库备份·rds
倒流时光三十年3 天前
第二阶段 15 · prefix / wildcard / fuzzy 模糊匹配
es
粗体鱼3 天前
RAG/Agent 记忆混合检索多路召回:RRF 算法与Chunk RRF、Document RRF如何决策TopK
postgresql·milvus·es·rag·rff·mermory
国际云,接待5 天前
AWS账单防爆雷实战:Budgets、Cost Anomaly Detection与预算动作联动
人工智能·aws·twitter·finops·云成本·budgets
故乡dee云5 天前
AWS 月度账单怎么看?费用明细、扣款时间和结算规则说明
云计算·aws