I have a custom plugin which implements RestHandler and intercepts the incoming request via the handleRequest method.
I have a requirement that if the incoming query uri is like /*/_search then i need to replace the uri with certain index names defined in elasticsearch.yml file as white list indexes
for ex: if the incoming uri is /*/_search then convert the uri to /index1,index2/_search
i tried creating new custom RestRequest object by extending RestRequest class and setting the path with the modified uri and then chaining the new RestRequest object
this.restHandler.handleRequest(newrequest, channel, client);
However still the query that executed by ES would be /*/_search. How can i achieve the above requirement