Encountered a 504 Gateway timeout error while executing a script in elastic search.
{
"query": {
"bool": {
"filter": {
"script": {
"script": " doc['creted_date'].date.getMonthOfYear() == 12 "
}
}
}
},
"aggs": {
"test": {
"date_histogram": {
"field": "creted_date",
"interval": "month",
"format": "MMM"
},
"aggs": {
"cost": {
"sum": {
"field": "cost"
}
}
}
}
}
}
Error result :
{
"statusCode": 504,
"error": "Gateway Time-out",
"message": "Client request timeout"
}
When executing this script on an index with a small number of documents, it works fine. However, on an index with a large number of documents, the above error is encountered.
Is there a way to manually adjust the request timeout for elastic search or are there any other solutions to address this issue?