ElasticSearch Query time - how to decrease the response time

Hi,

I am a newbie to elasticsearch. I am executing some queries on elastic search.
Some of the queries are taking long time to execute first time and on rerun response time reduces.

However, first time execution is nearing 16 secs for some of the queries.

I have increased the vCPU from 1vCPU to 2vCPU (ElasticSearch server
is running as a VM) and I can see certain decrease in the response time
("took" in elastic search).

All the other settings are default except I have set the ES_HEAP_SIZE to 4g.

Can someone please help and summarize, what all factors (both
hardware and software e.g. query construct) affect the response time in
ElasticSearch. I am using 8GB RAM

I am using Java to query ES.

Thanks,
Puneet

Hi,

Please share some queries that you're executing and tell something about your data design.

Artur