How can I prevent HTTP 504 gateway timeout errors in Amazon OpenSearch Service?
2 minute read
I'm trying to resolve a 504 gateway timeout error in Amazon OpenSearch Service. How can I do this?
A load balancer sits in front of each OpenSearch Service domain. The load balancer distributes incoming traffic to the data nodes. If OpenSearch Service requests don't complete and return a confirmation within the idle timeout period, the load balancer closes the TCP connection. As a result, you receive an HTTP 504 gateway timeout error. An HTTP 504 gateway timeout error doesn't necessarily indicate a problem with your cluster—it just means that the request couldn't be completed within the idle timeout period.
Gateway timeout errors usually occur when you send too many requests at the same time or when you send complex requests. In both cases, the result is the same: OpenSearch Service can't complete the request within the idle timeout period.
Use one or more of the following methods to resolve HTTP 504 gateway timeout errors:
Enable slow logs for your OpenSearch Service index, and then specify logging thresholds. Slow logs can help you determine if a particular query is taking a long time to complete. If so, tune the query to resolve the 504 error. For more information, see Viewing OpenSearch Service slow logs.
Reduce the amount of data that OpenSearch Service must query for the requests. This reduces the amount of time required for the requests to complete.