Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoBoundingBoxQueryBuilder doesn't honor validation_method: coerce #31718

Closed
jpountz opened this issue Jul 2, 2018 · 1 comment
Closed

GeoBoundingBoxQueryBuilder doesn't honor validation_method: coerce #31718

jpountz opened this issue Jul 2, 2018 · 1 comment
Assignees
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug

Comments

@jpountz
Copy link
Contributor

jpountz commented Jul 2, 2018

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);
    }
@jpountz jpountz added >bug :Analytics/Geo Indexing, search aggregations of geo points and shapes labels Jul 2, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

@imotov imotov assigned imotov and unassigned nknize Jul 2, 2018
imotov added a commit that referenced this issue Jul 3, 2018
The Rectangle constructor validates bounds before coerce has a chance
to normalize coordinates so it cannot be used as intermittent storage.
This commit removes the Rectangle as an intermittent storage for the
bounding box coordinates.

Fixes #31718
imotov added a commit that referenced this issue Jul 3, 2018
The Rectangle constructor validates bounds before coerce has a chance
to normalize coordinates so it cannot be used as intermittent storage.
This commit removes the Rectangle as an intermittent storage for the
bounding box coordinates.

Fixes #31718
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug
Projects
None yet
Development

No branches or pull requests

4 participants