I am using elasticsearch py client in my real time application.
The application performs search query aggregations like "sum of field settledAmount in last 10 days".
Most of queries work without problems. However a tiny percent fail silently returning the following.
{
"took":0,
"timed_out":false,
"_shards":{
"total":0,
"successful":0,
"skipped":0,
"failed":0
},
"hits":{
"total":{
"value":0,
"relation":"eq"
},
"max_score":0.0,
"hits":[
]
}
}
When the same query is repeated the response is correct containing the aggregations field and the expected value.
{
"took" : 191,
"timed_out" : false,
"_shards" : {
"total" : 756,
"successful" : 756,
"skipped" : 632,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"total_settled_amount" : {
"value" : 0.0
},
"unique_customer_count" : {
"value" : 0
}
}
}
I added some retries and it seems to be related with a load problem, since retrying the query without a significant delay (1s) will end in the exact same wrong result.
This is a query example
GET cases-*/_search
{
"from": 0,
"size": 1000,
"query": {
"bool": {
"filter": [
{
"range": {
"transactionAnnouncedEvent.transaction.processedAt": {
"from": "2024-08-29T00:00:00.000Z",
"to": "2024-08-29T13:46:49.000Z",
"include_lower": true,
"include_upper": true,
"boost": 1
}
}
},
{
"bool": {
"should": [
{
"term": {
"field1": {
"value": "abc",
"boost": 1
}
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"_source": {
"includes": [
"caseId"
],
"excludes": []
},
"aggs": {
"total_settled_amount": {
"sum": {
"field": "settledAmount"
}
}
}
}
What might be the reason of elasticsearch returning such "empty response" instead of a "429 status code?"