Skip to content

geo_shape 'within' query regression in 6.6 #40085

Closed
@MohamedHamouGisaia

Description

@MohamedHamouGisaia

Elasticsearch version
Version: 6.6.1, Build: default/zip/1fd8f69/2019-02-13T17:10:04.160291Z, JVM: 1.8.0_181

Plugins installed:
None

JVM version :
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

OS version
Linux tizintest 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
I indexed (with BKD-tree indexation) 4 shapes which coordinates are :
P1 : [ [ 3, 4 ], [ 4, 4 ], [ 4, 3 ], [ 3, 3 ], [ 3, 4 ] ]
P2 : [ [ 6, 2 ], [ 7, 2 ], [ 7, 1 ], [ 6, 1 ], [ 6, 2 ] ]
P3 : [ [ 3, 1 ], [ 4, 1 ], [ 4, 0 ], [ 3, 0 ], [ 3, 1 ] ]
P4 : [ [ 0, 2 ], [ 1, 2 ], [ 1, 1 ], [ 0, 1 ], [ 0, 2 ] ]

image

Querying all the shapes that are within the dashed polygon only returns polygons P1 and P2
The four polygons are returned in 6.5
(dashed polygon coordinates : [ [ 0, 4 ], [ 7, 4 ], [ 7, 0 ], [ 0, 0 ], [ 0, 4 ] ])

Steps to reproduce:

  1. Index creation
curl -X PUT "localhost:9200/test_index" -H 'Content-Type: application/json' -d'
{
    "mappings": {
        "_doc": {
            "properties": {
                "location": {
                    "type": "geo_shape"
                }
            }
        }
    }
}
'
  1. Indexing polygons (here P1 only)
curl -X POST "localhost:9200/test_index/_doc?refresh" -H 'Content-Type: application/json' -d'
{
    "location": {
    "type": "Polygon",
    "coordinates": [
      [ [ 3, 4 ], [ 4, 4 ], [ 4, 3 ], [ 3, 3 ], [ 3, 4 ] ]
    ]
  }
}
'
  1. Querying all the shapes that are within the dashed polygon
curl -X GET "localhost:9200/test_index/_search" -H 'Content-Type: application/json' -d'
{
  "query": {
    "geo_shape": {
      "location": {
        "shape": {
          "type": "Polygon",
          "coordinates": [[[0, 4], [7, 4], [7, 0], [0, 0], [0, 4]]]
        },
        "relation": "within"
      }
    }
  }
}
'

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Analytics/GeoIndexing, search aggregations of geo points and shapes>bugTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)v6.6.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions