-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Closed
Copy link
Labels
Description
Describe the bug
I have an index with a single document. The document is pretty simple, with two fields (a date and a number).
If I do an aggregation search on one of the fields, it works nicely. If I do the aggregation on both fields, it gives an error
Related component
Search:Aggregations
To Reproduce
- Go to the console, and create the index:
PUT /my_test/
{"mappings":{
"properties": {"date_created": {"type":"date"},
"distribution":{"properties": {"number_events":{"type":"unsigned_long"}}}
}
}
}
- Create a document
PUT /my_test/_doc/1
{"date_created":"2024",
"distribution":{"number_events":1000000}
}
- Do the query:
GET /my_test/_search
{
"size":0,
"aggs": {
"year": {"date_histogram": {"field": "date_created",
"interval": "year", "format": "yyyy"}},
"number_events": {"range": {
"field": "distribution.number_events",
"ranges": [{"key": "0--999", "from": 0, "to": 1000},
{"key": "999--", "from": 1000, "to": 10000000000000}
]}}
}
}
The query returns a 500:
{
"error": {
"root_cause": [
{
"type": "array_index_out_of_bounds_exception",
"reason": "Array index out of range: 16"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "my_test",
"node": "Wy_wWhnNSlC1DsV6R-sBtw",
"reason": {
"type": "array_index_out_of_bounds_exception",
"reason": "Array index out of range: 16"
}
}
],
"caused_by": {
"type": "array_index_out_of_bounds_exception",
"reason": "Array index out of range: 16",
"caused_by": {
"type": "array_index_out_of_bounds_exception",
"reason": "Array index out of range: 16"
}
}
},
"status": 500
}
Expected behavior
The query should not return a 500. It should return the proper value
Additional Details
It is probably related with the unsigned_long type. If, instead of unsigned_long, I use long, the query works properly
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": null,
"hits": []
},
"aggregations": {
"year": {
"buckets": [
{
"key_as_string": "2024",
"key": 1704067200000,
"doc_count": 1
}
]
},
"number_events": {
"buckets": [
{
"key": "0--999",
"from": 0,
"to": 1000,
"doc_count": 0
},
{
"key": "999--",
"from": 1000,
"to": 10000000000000,
"doc_count": 1
}
]
}
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done