# Elasticsearch Geo search problem (maybe bug)

**URL:** <https://discuss.elastic.co/t/elasticsearch-geo-search-problem-maybe-bug/36346>\
**Category:** Elasticsearch\
**Created:** [December 4, 2015, 4:47am UTC](https://discuss.elastic.co/t/elasticsearch-geo-search-problem-maybe-bug/36346 "2015-12-04T04:47:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave\_padovano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dave_padovano/32/848_2.png) [@dave\_padovano](https://discuss.elastic.co/u/dave_padovano)\
**Post date:** [December 4, 2015, 4:47am UTC](https://discuss.elastic.co/t/elasticsearch-geo-search-problem-maybe-bug/36346/1 "2015-12-04T04:47:00Z")

</div>

I'm experiencing some very strange behavior from Elasticsearch. I am using **geo\_bounding\_box** to search the area visible in Google Maps. I have data in New York and San Fransisco. New York behaves as expected. San Fransisco does not, which is confusing the shit out of me.

When searching in San Fransisco, I have to invert the longitude for east and west in order for data to be returned.

Searching in New York works just fine

 ![](https://us1.discourse-cdn.com/elastic/original/2X/9/927b7ae18447f116f77a9b091eb2ad1ea5730f36.png)

```
// New York
"geo_bounding_box" : {
    "location.coordinates": {
        "top_right": [40.75595545633613,-73.85303608398436],
        "bottom_left": [40.64820096366504,-74.03156391601561]
    }
}

```

 ![](https://i.imgur.com/BIYC3aO.png)

```
// San Fransisco (Normal)
"geo_bounding_box": {
    "location.coordinates": {
        "top_right": [37.79734048601642,-122.39438402099609],
        "bottom_left": [37.7692568462339,-122.4390159790039]
    }
}

```

 ![](https://i.imgur.com/mFHwwHh.png)

```
// San Fransisco (Normal)
"geo_bounding_box": {
    "location.coordinates": {
        "top_right": [37.79734048601642,-122.39438402099609],
        "bottom_left": [37.7692568462339,-122.4390159790039]
    }
}

```

As you can see, swapping the longitude values returns results but it does not make any sense because we are searching outside of the bounding box.

I am using elasticsearch Version: 1.4.4

[EDIT] This is an example of geo data stored in the San Fransisco area

```
"location": {
    "coordinates": [37.7876027, -122.4215609],
    "type": "Point"
 }
```

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [December 8, 2015, 10:01am UTC](https://discuss.elastic.co/t/elasticsearch-geo-search-problem-maybe-bug/36346/2 "2015-12-08T10:01:33Z")

</div>

Hi,

not sure how you defined your mapping, but when indexing geopoints with as array the format according to the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/1.4/mapping-geo-point-type.html) it [lon, lat], so your SF point would be [-122.42, 37.7876]. Of course the order in the query would also have to be changed. This is the coordinate order definet in [GeoJson](http://geojson.org/).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:32pm UTC](https://discuss.elastic.co/t/elasticsearch-geo-search-problem-maybe-bug/36346/3 "2017-07-05T23:32:41Z")

</div>


