-
Notifications
You must be signed in to change notification settings - Fork 25.8k
GEO: intersects search for geo_shape return wrong result #49017
Copy link
Copy link
Closed
Labels
:Analytics/GeoIndexing, search aggregations of geo points and shapesIndexing, search aggregations of geo points and shapes>bugv7.6.0v8.0.0-alpha1
Description
Linestring intersect with polygon return wrong results!
Bug reappear method:
1、Create index use restful API like this, add insert two data:
curl -H "Content-Type: application/json" -XPUT 'http://localhost:9200/example' -d '
{
"mappings": {
"properties": {
"location": {
"type": "geo_shape"
}
}
}
}
'
curl -H "Content-Type: application/json" -XPOST 'http://localhost:9200/example/_doc?refresh' -d '
{
"name": "mytest1",
"location" : {
"type" : "polygon",
"coordinates" : [
[ [5, 5], [10, 6], [10, 10], [5, 10], [5, 5] ]
]
}
}
'
curl -H "Content-Type: application/json" -XPOST 'http://localhost:9200/example/_doc?refresh' -d '
{
"name": "qingdao",
"location" : {
"type" : "polygon",
"coordinates" : [
[ [6, 6], [9, 6], [9, 9], [6, 9], [6, 6] ]
]
}
}
'
2、Use intersects to search, It returns only one piece of data(In fact, both data meet the spatial intersect with the linestring)
curl -H "Content-Type: application/json" -XGET 'http://localhost:9200/example/_search' -d '
{
"query":{
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_shape": {
"location": {
"shape": {
"type": "linestring",
"coordinates" : [ [0, 0], [5, 5], [7, 7] ]
},
"relation": "intersects"
}
}
}
}
}
}
'
{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":1.0,"hits":[{"_index":"example","_id":"4zx-Y24BTFMtLEcLyvV6","_score":1.0,"_source":
{
"name": "mytest1",
"location" : {
"type" : "polygon",
"coordinates" : [
[ [5, 5], [10, 6], [10, 10], [5, 10], [5, 5] ]
]
}
}
}]}}
I don't know why miss polygon [ [6, 6], [9, 6], [9, 9], [6, 9], [6, 6] ]?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
:Analytics/GeoIndexing, search aggregations of geo points and shapesIndexing, search aggregations of geo points and shapes>bugv7.6.0v8.0.0-alpha1
Type
Fields
Give feedbackNo fields configured for issues without a type.