# What's wrong with this query (geo\_part)?

**URL:** <https://discuss.elastic.co/t/whats-wrong-with-this-query-geo-part/6580>\
**Category:** Elasticsearch\
**Created:** [February 3, 2012, 5:30am UTC](https://discuss.elastic.co/t/whats-wrong-with-this-query-geo-part/6580 "2012-02-03T05:30:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chance](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chance/32/88046_2.png) [@Chance](https://discuss.elastic.co/u/Chance)\
**Post date:** [February 3, 2012, 5:30am UTC](https://discuss.elastic.co/t/whats-wrong-with-this-query-geo-part/6580/1 "2012-02-03T05:30:45Z")

</div>

I have the following indexed:

- \_index: users
- \_type: user
- \_id: 3
- \_score: 1
- \_source: {
  - email: [abc@test.net](mailto:abc@test.net)
  - names: [
    - jack sparrow
    - some dude  
]

  - age\_in\_years: null
  - addresses: [
    - {
      - lat\_lon: 34.078567,-81.173366  
},

    - {
      - lat\_lon: 33.9864983,-81.0266605  
}  
]

  - medical\_conditions: []
  - identifiable\_features: []
  - identifications: []  
}

}

and I'm trying to follow the geo-distance tutorial on the site but I'm not  
having any luck with it. An example of what I've tried is below. I've also  
tried nixing the nested doc and going with an array of lat\_lons but that  
didn't work either. Any help would be greatly appreciated, _thanks_!

_Example of a query attempt:_

{

"query": {

```
"match_all": {}

```

},

"facets": {

```
"geo1": {

  "geo_distance": {

    "addresses.lat_lon": {

      "lat": 27.9409782,

      "lon": -82

    },

    "distance": "10mi"

  }

}

```

}

}

---

<div class="post-metadata">

**Author:** ![Chance](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chance/32/88046_2.png) [@Chance](https://discuss.elastic.co/u/Chance)\
**Post date:** [February 4, 2012, 8:19pm UTC](https://discuss.elastic.co/t/whats-wrong-with-this-query-geo-part/6580/2 "2012-02-04T20:19:20Z")

</div>

I figured it out. Looks like it was a combination of the above query and  
tire's indexing.

I just need to figure out how to translate the query i built by hand into  
tire's DSL.

Chance

On Fri, Feb 3, 2012 at 12:30 AM, Chance Dinkins [chanceusc@gmail.com](mailto:chanceusc@gmail.com) wrote:

> I have the following indexed:
> 
> - \_index: users
> - \_type: user
> - \_id: 3
> - \_score: 1
> - \_source: {
> - email: [abc@test.net](mailto:abc@test.net)
> - names: [
> - jack sparrow
> - some dude  
> ]
> 
> - age\_in\_years: null
> - addresses: [
> - {
> - lat\_lon: 34.078567,-81.173366  
> },
> 
> - {
> - lat\_lon: 33.9864983,-81.0266605  
> }  
> ]
> 
> - medical\_conditions: 
> - identifiable\_features: 
> - identifications:   
> }
> 
> }
> 
> and I'm trying to follow the geo-distance tutorial on the site but I'm not  
> having any luck with it. An example of what I've tried is below. I've also  
> tried nixing the nested doc and going with an array of lat\_lons but that  
> didn't work either. Any help would be greatly appreciated, _thanks_!
> 
> _Example of a query attempt:_
> 
> {
> 
> "query": {
> 
> ```
> "match_all": {}
> 
> ```
> 
> },
> 
> "facets": {
> 
> ```
> "geo1": {
> 
> "geo_distance": {
> 
> "addresses.lat_lon": {
> 
> "lat": 27.9409782,
> 
> "lon": -82
> 
> },
> 
> "distance": "10mi"
> 
> }
> 
> }
> 
> ```
> 
> }
> 
> }

---

<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 6, 2017, 3:40am UTC](https://discuss.elastic.co/t/whats-wrong-with-this-query-geo-part/6580/3 "2017-07-06T03:40:37Z")

</div>

Closed on July 6, 2017, 3:40am UTC


