Geo_Polygon q's

All,

I am trying to perform some benchmark testing on ES to see if I can find
all the points that fall within a polygon AND beat PostGIS. I am having
some trouble getting my query to work and would like to bounce some of it
off this list. Here is how I am running my tests.

  1. Load all of the Geonames data in to ES. There are 7.8 million points
    all over the world so I figure this would be a good use case. The schema
    looks like this. http://pastebin.com/GbVDjEMi
  2. Next, I extracted all the polygons for each country in the world. You
    can find the data here:
    http://ogr2elasticsearch.googlecode.com/files/polygons.zip
  3. Finally, I build up my query like this. http://pastebin.com/dMFeYeSJ The
    problem is that nothing happens and I don't know if it's because the query
    is wrong or if ES just can't handle that many points.

Any help on this would be greatly appreciated. I will post the full
workflow and results once I am done with this.

Regards,

Adam

I realize that when I copied the query text in to Pastebin, "coordinates"
was misspelled. It still does not work though.

Adam

Hiya Adam

 1.  Finally, I build up my query like this.
    http://pastebin.com/dMFeYeSJ The problem is that nothing
    happens and I don't know if it's because the query is wrong or
    if ES just can't handle that many points.

Have you tried using 'points' instead of 'coordinates'?

clint

Hmmm...Now I seem to be getting an error that it does not like the element
[filtered] http://pastebin.com/sZdMvnRa

Adam

On Mon, 2011-11-21 at 06:57 -0800, Adam Estrada wrote:

Hmmm...Now I seem to be getting an error that it does not like the
element [filtered] [2011-11-21 09:54:35,974][DEBUG][action.search.type ] [Anole] [geonames][2 - Pastebin.com

{ query: { filtered: { query: {...}, filter: {...} }}}

clint

Adam

Got it! I was missing the opening "query" node. Looks like with my
preliminary queries are about 2 times slower than with a spatial database.

Adam

Can you "wrap it" in a bounding box filter and then do the polygon?
Wrapping it can be using an "and" filter, with the bounding box as the
first filter, and the polygon as the second. Note that bounding box filter
can work on indexed lat lon, or in memory checks.

On Mon, Nov 21, 2011 at 6:21 PM, Adam Estrada estrada.adam@gmail.comwrote:

Got it! I was missing the opening "query" node. Looks like with my
preliminary queries are about 2 times slower than with a spatial database.

Adam

@kimchy,

Do you have any comments on this?

Adam