如何在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
相关产品推荐
相关产品推荐

