We are creating restclient for connection elastic server, and using HTTPentity for fetching data using index name
check below code
RestClient restClient = RestClient.builder(new HttpHost(Constents.ELK_URL, Constents.ELK_PORT, "http")).build();
HttpEntity entity = null;
entity = new NStringEntity(
"{ \n"+
""query": { \n"+
""bool": { \n"+
""must": [ \n"+
" { \n"+
"\"match\": { \n"+
"\"bank_client_entity_name.keyword\": { \n"+
" \"query\": \""+bankClientEntityName+"\" \n"+
"} \n"+
"} \n"+
"} \n"+
"] \n"+
"} \n"+
"}, \n"+
"\"sort\": [ \n"+
"{ \n"+
"\"timeperiod_id\": {\"order\" : \"desc\"}, \n"+
"\"date_status\": {\"order\" : \"desc\"} \n"+
"} \n"+
"], \n"+
" \"size\" : 1 \n"+
"}", ContentType.APPLICATION_JSON);
Response response = restClient.performRequest("GET", "/"+eLK_HIST_INDEX+"/_search",Collections.<String, String>emptyMap(),entity);
BufferedInputStream br = new BufferedInputStream(response.getEntity().getContent());
please tell me how to add security X-pack in this above code