502 response for Elasticsearch query

Hi,

My elasticsearch cluster has ingestion rate of 10k docs/sec continuously. My elasticsearch queries are failing and throwing 502 response.

Also I reduced ingestion rate to 1K docs/sec and checked the same queries but issue exists.
FYI My queries have term aggregations.

I checked CPU and memory usage, its normal.

Could anyone please help me to sort out this issue? If any additional details required, Please let me know, I am ready to share it.