OpenSearch/docs/java-api/query-dsl/geo-polygon-query.asciidoc

19 lines
592 B
Plaintext

[[java-query-dsl-geo-polygon-query]]
==== Geo Polygon Query
See {ref}/query-dsl-geo-polygon-query.html[Geo Polygon Query]
[source,java]
--------------------------------------------------
List<GeoPoint> points = new ArrayList<>(); <1>
points.add(new GeoPoint(40, -70));
points.add(new GeoPoint(30, -80));
points.add(new GeoPoint(20, -90));
QueryBuilder qb =
geoPolygonQuery("pin.location", points); <2>
--------------------------------------------------
<1> add your polygon of points a document should fall within
<2> initialise the query with field and points