Hi,
I'm trying to filter based on location with NEST using the docs here and post here. But I think my use case is different to those examples in two ways.
- I want to filter based on a point being Within a polygon/shape, but I want to filter the document associated with the shapes, not the point. As in "return only documents with a shape surrounding the point value given in the query".
- The documents with shapes can have a list of multiple shapes, and I want to filter out only those that have NO shape surrounding the point.
In general my setup is:
- A PointDocument index, each PointDocument has a lat/long point field.
- A ShapeDocument index, each ShapeDocument has a field with a list of shapes.
- We need to query the ShapeDocuments (based on other properties). For each query we have the ID of a PointDocument the results are for, and we have to filter the ShapeDocument search results to only those that have a shape surrounding the PointDocument's point field.
Is that possible? In NEST or in general?
What I'm trying at the moment is to use Intersects with a Polygon shape but I'm not even able to index the ShapeDocuments. What I have so far:
var shapeDocument = new ShapeDocument
{
// "shapes" is a List<List<GeoCoordinate>>
Shapes = new PolygonGeoShape(shapes)
};
I can successfully index documents with no GeoCoordinates and they look like:
{
"_index": "ShapeDocumentIndex",
"_type": "_doc",
"_id": "someid",
"_routing": "somerouting",
"_source": {
[other fields]
"shapes": {
"type": "polygon",
"coordinates": []
}
}
The error I get is:
Type: mapper_parsing_exception Reason: "object mapping for [shapeDocument.coordinates] tried to parse field [null] as object, but found a concrete value"
I've looked at a few posts around with that error message but I couldn't find any where the field being parsed is as "null", and I don't see why the PolygonGeoShape would be a concrete value?
Thanks very much for your help.