我希望能够执行批量重新索引请求并指定管道。管道空白了一些字段并添加了另一个字段,表明已采取此操作。出于安全考虑,脚本不是一种选择。
目的地索引只包含文件,以便他们通过管道。
我知道Java客户端无法做到这一点(可以批量重新索引但不能指定管道),但是在REST API中呢?
e.g。在这里批量执行底部的重新索引(假设将有来自其他地方的message_id
将有数百万的值):
#Create some data:
POST /mytestindex/message
{
"message_id": "123-456-789",
"body": "this is some text"
}
POST /mytestindex/message
{
"message_id": "234-567-890",
"body": "this is also some text"
}
#Create a pipeline to blank out the body field
PUT /_ingest/pipeline/my-test-pipeline
{
"description": "my test pipeline",
"processors": [{
"set": {
"field": "body",
"value": ""
}
}]
}
#reindex by message_id:
POST _reindex
{
"source": {
"index": "mytestindex",
"query": {
"match": {
"message_id": "123-456-789"
}
}
},
"dest": {
"index": "mytestindex_new",
"pipeline": "my-test-pipeline"
}
}
POST _reindex
{
"source": {
"index": "mytestindex",
"query": {
"match": {
"message_id": "234-567-890"
}
}
},
"dest": {
"index": "mytestindex_new",
"pipeline": "my-test-pipeline"
}
}
答案 0 :(得分:0)
是的,您可以使用REST API实现这一点,基本上就像这样
POST _reindex
{
"source": {
"index": "source"
},
"dest": {
"index": "dest",
"pipeline": "some_ingest_pipeline" <-- specify your pipeline here
}
}
答案 1 :(得分:0)
我认为我提出了错误的问题 - 我正在寻找一种使用批量API重新索引的方法,但似乎API还不支持批量api重新索引并指定管道。