use of org.opensearch.geometry.MultiLine in project OpenSearch by opensearch-project.
the class GeoPointShapeQueryTests method testQueryMultiLine.
public void testQueryMultiLine() throws Exception {
XContentBuilder xcb = createDefaultMapping();
client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
ensureGreen();
CoordinatesBuilder coords1 = new CoordinatesBuilder().coordinate(-35, -35).coordinate(-25, -25);
CoordinatesBuilder coords2 = new CoordinatesBuilder().coordinate(-15, -15).coordinate(-5, -5);
LineStringBuilder lsb1 = new LineStringBuilder(coords1);
LineStringBuilder lsb2 = new LineStringBuilder(coords2);
MultiLineStringBuilder mlb = new MultiLineStringBuilder().linestring(lsb1).linestring(lsb2);
MultiLine multiline = (MultiLine) mlb.buildGeometry();
try {
client().prepareSearch("test").setQuery(QueryBuilders.geoShapeQuery(defaultGeoFieldName, multiline)).get();
} catch (Exception e) {
assertThat(e.getCause().getMessage(), containsString("does not support " + GeoShapeType.MULTILINESTRING + " queries"));
}
}
Aggregations