I am ingesting millions of records into Elasticsearch and also extracting records from Elasticsearch. I am actually using Elasticsearch Java client. I am creating only one client on each JVM. Using this client, ingesting data into Elasticsearch and also extrating data from Elasticsearch using same. Extracted data writing into files and doing some analysing, again writing into files and ingestng data back into elasticsearch using.
Is this best way to create only one Java client on one JVM and keep it alive?
or create client when needed and ingest/extract data, close it.
Or create pool of clients and reuse it. (Like connection pooling)
What is the best way to do this ?