Description
Elastic.Clients.Elasticsearch version**: 8.18.0
Elasticsearch version: 8.16.0
.NET runtime version: 8.0.15
Operating system version: Windows 11
Description of the problem including expected versus actual behavior:
We are trying to execute a GeoDistanceQuery against a geo_point that has data stored as text in the following format
"25.76,-80.36"
The 2 errors are generated from trying to set the query location parameter from GeoLocation.Text(location) or
GeoLocation.LatitudeLongitude(new LatLonGeoLocation { Lat = lat, Lon = lon })
So any attempt results in failure.
Side notes:
We have even tried upgrading to 9.0.1 but we ran into #8512 but the good news is that with the proper code adjustments the generated query from debug view runs just fine in Postman (so only the header is stopping it from completing successfully)
Steps to reproduce:
1.Create geofilter
new GeoDistanceQuery
{
Field = "location_geo_point",
Distance = request.ProximityDistance, //"100km"
Location = geoLocation, //as per above mention
}
2.Set filter to query
3. Executed query
4. Exception thrown: "The given key 'Text' was not present in the dictionary" or "Unable to locate factory for multi-item union accepting a string value"
Expected behavior
Getting a filtered result since the the filter is applied only when there is a proximity search parameter set
Query finalQuery = null;
if (geoFilter != null)
{
finalQuery = new BoolQuery
{
Must = new List<Query> { functionScoreQuery },
Filter = new List<Query> { geoFilter }
};
}
else
{
finalQuery = functionScoreQuery;
}