Adding extra fields on reindexing

Hi,
How can I add extra filed's when I reindex the documents using Java API?

I tried below code and it doesn't work and fails with below exception

                Map<String, Object> params = new HashMap<>();
                params.put("newField", "test");
                ReindexRequestBuilder builder = ReindexAction.INSTANCE.newRequestBuilder(store.getClient()).source(sourceIndex)
                        .destination(destIndex);
                builder.destination().setVersionType(VersionType.EXTERNAL);
                builder.script(
                        new Script(ScriptType.INLINE, Script.DEFAULT_SCRIPT_LANG, "ctx.newfiled = newField",
                                params));
                BulkByScrollResponse bulkByScrollResponse = builder.execute().actionGet();

CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting

You can try to increase the script.max_compilations_per_minute setting and see if this helps your reindexing.

PUT /_cluster/settings
{
    "transient" : {
        "script.max_compilations_per_minute" : "2000/m"
    }
}

After the reindexing is done, you can set it back to its previous value

PUT /_cluster/settings
{
    "transient" : {
        "script.max_compilations_per_minute" : "15/m"
    }
}

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