How to make PreBuiltXPackTransportClient reusable?

Hello
Create a PreBuiltXPackTransportClient object need username and password,so every logined person will has their own PreBuiltXPackTransportClient object,
In order to make PreBuiltXPackTransportClient object reusable,I store them in a map,but if millions of people login in my system for searching,the map will take up more memory,and I don't known which PreBuiltXPackTransportClient object I should remove and clean .
What should I do for this problem?

You should move to the REST client. It has a Request Option that is probably useful for that.

See https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-low-usage-requests.html#java-rest-low-usage-request-options

Thanks dadoonet, I will try it

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