Gateway Timeout on Update By Query API

Some of our update by query requests (https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-update-by-query.html) are timing out and returning a 504 Gateway Timeout error:

  status: 504,
  displayName: 'GatewayTimeout',
  message: 'Gateway Timeout' 

What we're trying to do is find certain products that match the query_string and assign them a gender value.

Here's the query that is timing out:

POST /products/_update_by_query?conflicts=proceed
{
	"script": {
	    "id": "gender_women",
	    "lang": "groovy"
	},
	"query": {
	    "query_string": {
	        "query": "category:(skirts)"
	    }
	}
}

And the pre-defined script that changes the gender field on the product:

POST /_scripts/groovy/gender_women
{
     "script": "ctx._source.gender = \"women\""
}

I'm wondering what the cause of the Gateway Timeouts usually is and what we can do to make sure the queries are executed successfully.

Some background on our index, its an online product based index with about 250k documents.

We're running Elasticsearch 2.4.1 on a cluster with 8GB memory, hosted on Elastic Cloud. The index in question has 3 shards and 1 replica.

Thank You!

A 504 error is frequently caused by having a Load Balancer in front of your Elasticsearch cluster. If the timeout on the Load Balancer is shorter than the duration of your update-by-query requests, it will result in a 504.

This can also happen with some proxy servers.

We're on the Elastic Cloud hosting service.

Unfortunately I don't see a configurable load balancer timeout on there.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.