You can use geo-polygon query to query data that falls within a polygon geographic area. You can specify the polygon geographic area as a query condition. Tablestore returns the rows where the value of a field falls within the polygon geographic area.


Parameter Description
fieldName The name of the column. Set the query type to Geopoint.
points The coordinate pairs of the points that define a polygon area.

This parameter value must be in the format of "latitude,longitude". Valid values of the latitude: [-90,90]. Valid values of longitude: [-180,180]. Example: “35.8,-45.91".

query The query statement for the search index. Set the query type to GeoPolygonQuery.
tableName The name of the table.
indexName The name of the search index.


 * Query the table for rows where the value of Col_GeoPoint falls within a specified polygon geographic area.
 * @param client
public static void geoPolygonQuery(SyncClient client) {
    SearchQuery searchQuery = new SearchQuery();
    GeoPolygonQuery geoPolygonQuery = new GeoPolygonQuery();  // Set the query type to GeoPolygonQuery.
    geoPolygonQuery.setPoints(Arrays.asList("0,0","5,5","5,0")); // Specify coordinate pairs for vertices of a polygon geographic area.

    SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery);

    SearchRequest.ColumnsToGet columnsToGet = new SearchRequest.ColumnsToGet();
    columnsToGet.setColumns(Arrays.asList("Col_GeoPoint"));  // Specify that the Col_GeoPoint column is returned.

    SearchResponse resp =;
    System.out.println("TotalCount: " + resp.getTotalCount()); // Display the total number of matched rows instead of the number of returned rows.
    System.out.println("Row: " + resp.getRows());