How can I resolve 504 gateway timeout errors in Amazon Elasticsearch Service (Amazon ES)? 

A load balancer sits in front of each Amazon ES domain. The load balancer distributes incoming traffic to the data nodes, and then scales the Elasticsearch cluster, if necessary. The load balancer has an idle time-out value of 60 seconds. If Amazon ES requests don't complete and return a successful or unsuccessful confirmation within 60 seconds, the load balancer closes the TCP connection to the cluster. This usually results in a 504 gateway timeout error. A 504 error does not necessarily indicate a problem with the cluster—it simply means that the request couldn't be completed within 60 seconds.

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: Amazon ES can't complete the request within 60 seconds. 

Use one or more of the following methods to resolve HTTP 504 gateway timeout errors:

  • Reduce the amount of data that Amazon ES must query for the requests. This reduces the amount of time required for the requests to complete.
  • Switch to a larger instance type. For more information, see Choosing Instance Types and Testing.
  • Configure exponential backoff and retry mechanisms in your application so that requests that time out are sent again.
  • Use bulk requests instead of individual requests. This reduces the per-request overhead for the cluster.

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2018-10-26