The official document: https: //www.elastic.co/guide/en/shield/current/_using_elasticsearch_java_clients_with_shield.html
1. The simplest use, global configuration credentials request header of each request credentials will bring this client.
Settings = Settings.settingsBuilder Settings ()
.put ( "shield.user", "Xiangyang: 123456") Build ();.
Client Client TransportClient.builder = () Settings (Settings) .addPlugin (ShieldPlugin.class) .build. ()
.addTransportAddress (new new InetSocketTransportAddress (InetAddress.getByName ( "10.12.5.170"), 9300));
Use base64 encryption header, feeling less secure requests.