I have created Custom Action plugin for elastic in java. This plugin have rest handler for preparing request, action and transport action which has actual business logic for executing request.
This plugin was designed to find correct index from alias and update/insert the requested document in the same.
This works fine when I run for single document.
For bulk call, I wanted to add multithreading so that it will call action for each record in parallel.
I have used Executor service and submitted client.execute method in the loop of record list.
I am running this plugin on the cluster with elastic superuser.
It works fine for single document but when I try to call bulk, it gives me security exception as
org.elasticsearch.ElasticsearchSecurityException: action [cluster:admin/custom_updateorinsert] is unauthorised for user [_system] with effective roles [_system] , this action is granted by the cluster privileges [manage,all]
I am not using _system user anywhere in the code. Is there any way where we can avoid using internal user _system and use only elastic or user which I am passing in the request.
Also I am not sure from where _system is being used , is it because I used Executor to call client api.