Reindex part of Elasticsearch index onto new index

I have a test ElasticSearch 6.0 index populated with millions of records, likely to be in the billions in production. I need to search for a subset of these records, then save this subset of the original set into a secondary index for later searching. I have proven this out via querying ES on Kibana, the challenge is to find appropriate APIs in Java 8 using my Jest client (searchbox.io, version 5.3.3) to do the same. . How can this be accomplished in Java? It seems that the current APIs do not support what I am proposing to do and I have hit a dead-end using the HttpUrlConnection class... Below is a partial snippet of what works in Kibana. Any help or guidance is very much appreciated.

POST _reindex?slices=10&wait_for_completion=false
{
"conflicts":"proceed",
"source":{
"index":"source_idx",
"size":5000,
"query":{
"bool":{
"filter":{
"bool":{
"must":[
{
"nested":{
"path":"foo",
"query":{
"bool":{
"must":[
{ ...
}
}
},
"dest":{
"index":"my_dest_idx"
},
"script" :
{
"id": "my_saved_painless_script",
"params" :
{ ...
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.