Skip to content

GeoBoundingBoxQueryBuilder doesn't honor validation_method: coerce #31718

Closed
@jpountz

Description

@jpountz

The Rectangle constructor validates bounds before coerce has a chance to to normalize coordinates. Here is a test case that reproduces the bug:

    public void testHonorsCoercion() throws IOException {
        assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0);
        String query = "{\n" + 
                "  \"geo_bounding_box\": {\n" + 
                "    \"validation_method\": \"COERCE\",\n" + 
                "    \"location\": {\n" + 
                "      \"top_left\": {\n" + 
                "        \"lat\": -15.5,\n" + 
                "        \"lon\": 176.5\n" + 
                "      },\n" + 
                "      \"bottom_right\": {\n" + 
                "        \"lat\": -19.6,\n" + 
                "        \"lon\": 181\n" + 
                "      }\n" + 
                "    }\n" + 
                "  }\n" + 
                "}\n";
        assertGeoBoundingBoxQuery(query);
    }

Metadata

Metadata

Assignees

Labels

:Analytics/GeoIndexing, search aggregations of geo points and shapes>bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions