If we aggregate over zero records, we get POINT (NaN NaN). I think the default behaviour in ES|QL is to return null instead of NaN, and in this case a null centroid, not null coordinates.
For example:
FROM airports
| WHERE ST_INTERSECTS(location, city_location)
| STATS centroid=ST_CENTROID_AGG(location), count=COUNT()
Returns:
centroid:geo_point | count:long
POINT (NaN NaN) | 0
But should return:
centroid:geo_point | count:long
null | 0
And a warning.
Steps to Reproduce
Create an index with two geo_point fields, but do not add any documents.
Query with:
FROM index | STATS centroid=ST_CENTROID_AGG(location, other_location), count=COUNT(*)
Elasticsearch Version
8.14
Installed Plugins
No response
Java Version
bundled
OS Version
all
Problem Description
If we aggregate over zero records, we get POINT (NaN NaN). I think the default behaviour in ES|QL is to return null instead of NaN, and in this case a null centroid, not null coordinates.
For example:
Returns:
But should return:
And a warning.
Steps to Reproduce
Create an index with two geo_point fields, but do not add any documents.
Query with:
Logs (if relevant)
No response