Modify Request Content from Kibana

Hi all,

I am currently trying to modify the content of a RestRequest in a custom plugin. I'm able to print the contents to the debugger, but I'm not sure of the best practice to modify it.

I've written a small extension around the RestRequest to set the content to a given BytesReference, but I'm not sure how to manipulate that.

Do you know of a way to either modify the BytesReference stored in RestRequest.content or convert a String back into a BytesReference?

Ideally this would be used to add a forced variable filter to every _msearch from kibana. Is there a better way to implement this?

Thanks for your help!

Justin