You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在OpenSearch中借助Query DSL实现每小时定期重索引?

需求与实现代码

我需要每小时执行定期重索引任务,仅重索引符合自定义Query DSL的部分文档,同时借助ingest pipeline和自定义脚本对新索引的文档进行更新,具体实现的API请求代码如下:

POST _reindex?wait_for_completion=false
{
  "source": {
    "index": "index",
    "query": {
      "bool": {
        "filter": {
            "terms": {
                "Domain.keyword":  ["Custom.Value0", "Custom.Value1", "Custom.Value2"]
            }
        }
      }
    }
  },
  "dest": {
    "index": "new-index-clean",
    "pipeline": "my-pipeline"
  },
  "script": {
      "lang": "painless",
      "source": "if (!ctx._source.containsKey(\"Field\") || ctx._source.Field == null) {ctx._source.Field = ctx._index}"
    }
}
当前遇到的问题
  • 已在OpenSearch实例上安装Job Scheduler插件,但无法安装自定义插件,也找不到该插件用于调度上述重索引任务的具体使用方式
  • 尝试过使用Rollups和Transform job,但二者均无法满足我的重索引需求

内容的提问来源于stack exchange,提问作者Amaury Lecoq

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 00:52:34