弹性搜索中的 运行 脚本出错,网关超时
Error while running script in elastic search , gateway timeout
在弹性搜索中 运行 脚本时,出现 504 网关超时错误。
{
"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"
}
}
}
}
}
}
错误结果:
{
"statusCode": 504,
"error": "Gateway Time-out",
"message": "Client request timeout"
}
每当我 运行 这个索引上有少量文档的脚本时,它都会提供完美的输出。但是在有大量文件的索引上,它给出了上述错误。
elasticsearch可以手动设置请求的超时时间吗?或者这个问题还有其他解决方案吗?
试试这个。
{
"query": {
"bool": {
"filter": {
"script": {
"lang": "expression",
"script": "doc['creted_date'].getMonth() == month-1",
"params": {
"month": 12
}
}
}
}
}
}
为 Elasticsearch 试试这个 6.x。
{
"query": {
"bool": {
"filter": {
"script": {
"script": {
"source": "doc['created_on'].date.getMonthOfYear() == params.month",
"params": {
"month": 5
}
}
}
}
}
}
}
在弹性搜索中 运行 脚本时,出现 504 网关超时错误。
{
"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"
}
}
}
}
}
}
错误结果:
{
"statusCode": 504,
"error": "Gateway Time-out",
"message": "Client request timeout"
}
每当我 运行 这个索引上有少量文档的脚本时,它都会提供完美的输出。但是在有大量文件的索引上,它给出了上述错误。
elasticsearch可以手动设置请求的超时时间吗?或者这个问题还有其他解决方案吗?
试试这个。
{
"query": {
"bool": {
"filter": {
"script": {
"lang": "expression",
"script": "doc['creted_date'].getMonth() == month-1",
"params": {
"month": 12
}
}
}
}
}
}
为 Elasticsearch 试试这个 6.x。
{
"query": {
"bool": {
"filter": {
"script": {
"script": {
"source": "doc['created_on'].date.getMonthOfYear() == params.month",
"params": {
"month": 5
}
}
}
}
}
}
}