What's wrong with this query (geo_part)?


(Chance) #1

I have the following indexed:

  • _index: users
  • _type: user
  • _id: 3
  • _score: 1
  • _source: {
    • email: 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"

  }

}

}

}


(Chance) #2

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 wrote:

I have the following indexed:

  • _index: users
  • _type: user
  • _id: 3
  • _score: 1
  • _source: {
    • email: 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"

  }

}

}

}


(system) #3