Search in sources :

Example 11 with MultiPoint

use of org.opensearch.geometry.MultiPoint in project OpenSearch by opensearch-project.

the class GeoPointShapeQueryTests method testQueryMultiPoint.

public void testQueryMultiPoint() throws Exception {
    XContentBuilder xcb = createDefaultMapping();
    client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
    ensureGreen();
    MultiPointBuilder mpb = new MultiPointBuilder().coordinate(-35, -25).coordinate(-15, -5);
    MultiPoint multiPoint = mpb.buildGeometry();
    try {
        client().prepareSearch("test").setQuery(QueryBuilders.geoShapeQuery(defaultGeoFieldName, multiPoint)).get();
    } catch (Exception e) {
        assertThat(e.getCause().getMessage(), containsString("does not support " + GeoShapeType.MULTIPOINT + " queries"));
    }
}
Also used : MultiPoint(org.opensearch.geometry.MultiPoint) MultiPointBuilder(org.opensearch.common.geo.builders.MultiPointBuilder) XContentBuilder(org.opensearch.common.xcontent.XContentBuilder) SearchPhaseExecutionException(org.opensearch.action.search.SearchPhaseExecutionException)

Aggregations

MultiPoint (org.opensearch.geometry.MultiPoint)11 Point (org.opensearch.geometry.Point)7 ArrayList (java.util.ArrayList)5 XContentBuilder (org.opensearch.common.xcontent.XContentBuilder)3 Geometry (org.opensearch.geometry.Geometry)3 Coordinate (org.locationtech.jts.geom.Coordinate)2 MultiPointBuilder (org.opensearch.common.geo.builders.MultiPointBuilder)2 Point (org.locationtech.jts.geom.Point)1 Point (org.locationtech.spatial4j.shape.Point)1 Shape (org.locationtech.spatial4j.shape.Shape)1 JtsPoint (org.locationtech.spatial4j.shape.jts.JtsPoint)1 OpenSearchParseException (org.opensearch.OpenSearchParseException)1 SearchPhaseExecutionException (org.opensearch.action.search.SearchPhaseExecutionException)1 XShapeCollection (org.opensearch.common.geo.XShapeCollection)1 Circle (org.opensearch.geometry.Circle)1 GeometryCollection (org.opensearch.geometry.GeometryCollection)1 Line (org.opensearch.geometry.Line)1 MultiLine (org.opensearch.geometry.MultiLine)1 ShapeType (org.opensearch.geometry.ShapeType)1