How to use 'run as' in the Java transport client

Hi,

I'm using the 5.5.0 Java transport client and I'd like to submit a search request using the 'run as' feature, but I'm not sure how I go about it. Are there any examples available?

Thanks,

Aaron

Do something like this

Map<String, String> headers = new HashMap<>();
headers.put("Authorization", UsernamePasswordToken.basicAuthHeaderValue("your_user", new SecureString("password".toCharArray())));
headers.put("es-security-runas-user", "your_user_to_run_as");

client.filterWithHeader(headers).admin().cluster().prepareHealth().get();

Thanks @spinscale I'll give it a try when I get the chance.

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