You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @arthurvb, the GeoShapeQuery indeed is one of the few things missing right now. It's definitely planned to bring back support for this, but in the meantime there is no workaround 🙁 (except for completely hand-crafting the query using the low-level client).
For those also stumble across this problem, this cannot be accomplished with QueryDescriptor<>.RawJson and RawJsonQuery.
The RawJsonQuery description says the following.
Allows a query represented as a string of JSON to be defined. This can be useful when support for a built-in query is not yet available.
However, the behavior I see is different from what I expected. I tried the following code snippet.
// https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.htmlvarfilter=new{
geo_shape =new{
location =new{
shape = geometryCollection,
relation ="within"}}};varqueryString= JsonSerializer.Serialize(filter);varresult=await _client.SearchAsync<Prospect>(s => s.Query(q => q.RawJson(new RawJsonQuery(queryString)))// Line of code in question// .Query(new RawJsonQuery(queryString))) An alternative way, but same result);
Current Behavior
However the generated query was the following.
{
"query": {
"raw_json": { // The "raw_json" query type does not exist. I'm pretty sure this is not intended behavior."geo_shape": {
"location": {
"shape": {
"type": "GeometryCollection",
"geometries": [
{
"type": "MultiPolygon",
"coordinates": [
// skip for brevity
]
}
]
},
"relation": "within"
}
}
}
}
}
Is your feature request related to a problem? Please describe.
We want to port our (Nest) Elastic API to the v8. Currently we use the
GeoShapeQuery
, mapping to https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.html . However it seems that in the latest version we cannot create this query type.Describe the solution you'd like
A way to create GeoShapeQuery's in the latest C# Elastic Client API
Describe alternatives you've considered
Looking at bounding boxes, geopolygon queries, but they all have different semantics
Additional context
Many thanks in advance!
The text was updated successfully, but these errors were encountered: