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

Geo search fails to find some docs when wrapping over IDL #559

Closed
andreiz opened this issue Dec 9, 2010 · 1 comment
Closed

Geo search fails to find some docs when wrapping over IDL #559

andreiz opened this issue Dec 9, 2010 · 1 comment

Comments

@andreiz
Copy link

andreiz commented Dec 9, 2010

It seems that the geo_bounding_box query fails to find some documents when the box crosses over the IDL (international date line). To reproduce (in 0.13.1):

curl -XPUT 'http:https://localhost:9200/test' -d'{ index : { number_of_shards : 1, number_of_replicas : 0 } }';

curl -XPUT 'http:https://localhost:9200/test/place/_mapping' -d'
{
    "place" : {
        "_all" : {"enabled" : false},
        "properties" : {
            "user_id" : {"type" : "integer", "index" : "not_analyzed"},
            "title" : {"type" : "string", "boost" : 1.5, "analyzer" : "eulang"},
            "notes" : {"type" : "string", "analyzer" : "eulang"},
            "tags" : {"type" : "string", "index_name" : "tag", "boost" : 1.5, "analyzer" : "eulang"},
            "created_on" : {"type" : "date", "format" : "YYYY-MM-DD HH:mm:ss"},
            "geo" : {"type" : "geo_point"},
            "privacy" : {"type" : "integer", "index" : "not_analyzed"}
        }
    }
}'

curl http:https://localhost:9200/test/place/10 -d'{"user_id": 880, "privacy": 2000, "notes": "", "tags": [], "created_on": "2010-12-09 08:05:17", "title": "Place in Stockholm", "geo": {"lat": 59.328355000000002, "lon": 18.036842}}';

curl http:https://localhost:9200/test/place/20 -d'{"user_id": 534, "privacy": 2000, "notes": "", "tags": [], "created_on": "2010-11-26 10:22:38", "title": "Place in Montréal", "geo": {"lat": 45.509526999999999, "lon": -73.570986000000005}}';

This fails to find the doc titled "Place in Stockholm":

curl 'http:https://localhost:9200/test/_search' -d'
{
    "query": {
        "filtered": {
            "filter": {
                "and": [
                    {
                        "term": {
                            "user_id": 880
                        }
                    },
                    {
                        "geo_bounding_box": {
                            "geo": {         
                                "bottom_right": {
                                    "lat": -66.668903999999998, 
                                    "lon": 113.96875            
                                },                              
                                "top_left": {                   
                                    "lat": 74.579421999999994,  
                                    "lon": 143.5                
                                }                               
                            }                                   
                        }                                       
                    }                                          
                ]                                              
            },
            "query": {
                "match_all": {}
            }
        }
    }
}'
{"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

But this does find the place title "Place in Montréal":

curl 'http:https://localhost:9200/test/_search' -d'
{
    "query": {
        "filtered": {
            "filter": {
                "and": [
                    {
                        "term": {
                            "user_id": 534
                        }
                    },
                    {
                        "geo_bounding_box": {
                            "geo": {
                                "bottom_right": {
                                    "lat": -66.668903999999998,
                                    "lon": 113.96875
                                },
                                "top_left": {
                                    "lat": 74.579421999999994,
                                    "lon": 143.5
                                }
                            }
                        }
                    }
                ]
            },
            "query": {
                "match_all": {}
            }
        }
    }
}'
{"_shards":{"total":1,"successful":1,"failed":0},"hits" {"total":1,"max_score":1.0,"hits":[{"_index":"test","_type":"place","_id":"20","_score":1.0, "_source" : {"user_id": 534, "privacy": 2000, "notes": "", "tags": [], "created_on": "2010-11-26 10:22:38", "title": "Place in Montréal", "geo": {"lat": 45.509526999999999, "lon": -73.570986000000005}}}]}}

Both of those places fall within the bounding box, though.

@kimchy
Copy link
Member

kimchy commented Dec 10, 2010

Geo search fails to find some docs when wrapping over IDL, closed by 2a7f964.

medcl pushed a commit to medcl/elasticsearch that referenced this issue Jul 1, 2011
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants