Bulk Insert GeoJSON from Postgresql


(Adam Estrada) #1

All,

It's relatively simple to get spatial data from Postgres. The
following example is geojson exported directly from Postgis.

http://pastebin.com/25NsAteH

What would I have to do to bulk load the data in to ES?

Thanks in advance,
Adam


(Shay Banon) #2

First, you will need to create an index, and have geo_type mapping on at
least the geometry.coordinates (see
http://www.elasticsearch.org/guide/reference/mapping/geo-point-type.html).

Then you will need to use your favorite lang to read the data from the
database and index it into elasticsearch.

On Mon, Aug 1, 2011 at 9:01 PM, Adam Estrada estrada.adam@gmail.com wrote:

All,

It's relatively simple to get spatial data from Postgres. The
following example is geojson exported directly from Postgis.

http://pastebin.com/25NsAteH

What would I have to do to bulk load the data in to ES?

Thanks in advance,
Adam


(Adam Estrada) #3

I literally have no idea how to get this in to ES. It's properly
formatted GeoJSON from OGR2OGR. Any tips on bulk loading this would be
great!

{
"type":"FeatureCollection",
"features":[{
"type":"Feature",
"properties":{
"id":1376628261,
"owner":"62311807@N05",
"secret":"f9a4598e7d",
"server":5109,
"farm":6,
"title":"Relax.",
"accuracy":11,
"place_id":"_cv6vY5WV7_DBdU",
"woeid":755126,
"translated":"Relax ",
"tags":"",
"date_taken":"2010/07/22",
"url":"http://www.flickr.com/photos/
62311807@N05/5671595557/",
"description":"",
"photo_url":"http://farm6.static.flickr.com/
5109/5671595557_f9a4598e7d_z.jpg",
"date_inserted":"2011/07/24"
},
"geometry":{
"type":"Point",
"coordinates":[-3.293151,
36.940974
]
}
}
]
}

On Aug 1, 2:01 pm, Adam Estrada estrada.a...@gmail.com wrote:

All,

It's relatively simple to getspatialdata from Postgres. The
following example is geojson exported directly from Postgis.

http://pastebin.com/25NsAteH

What would I have to do to bulk load the data in to ES?

Thanks in advance,
Adam


(Adam Estrada) #4

Ahh,

Thanks Shay! I was hoping to use the bulk loader like Sophia did here.

That would be perfect. Otherwise I suppose it would be easy enough to
script this in to ES.

Adam

On Aug 1, 4:59 pm, Shay Banon kim...@gmail.com wrote:

First, you will need to create an index, and have geo_type mapping on at
least the geometry.coordinates (seehttp://www.elasticsearch.org/guide/reference/mapping/geo-point-type.html).

Then you will need to use your favorite lang to read the data from the
database and index it into elasticsearch.

On Mon, Aug 1, 2011 at 9:01 PM, Adam Estrada estrada.a...@gmail.com wrote:

All,

It's relatively simple to get spatial data from Postgres. The
following example is geojson exported directly from Postgis.

http://pastebin.com/25NsAteH

What would I have to do to bulk load the data in to ES?

Thanks in advance,
Adam


(Shay Banon) #5

elasticsearch has a REST API and a built in Java API. If you want to use the
REST API, then I suggest using one of the client libs listed here:
http://www.elasticsearch.org/guide/appendix/clients.html.

I suggest, if you want to get familiar with elasticsearch in a very high
level, to go through the README on the github project and use curl to work
with it: https://github.com/elasticsearch/elasticsearch.

On Tue, Aug 2, 2011 at 12:03 AM, Adam Estrada estrada.adam@gmail.comwrote:

I literally have no idea how to get this in to ES. It's properly
formatted GeoJSON from OGR2OGR. Any tips on bulk loading this would be
great!

{
"type":"FeatureCollection",
"features":[{
"type":"Feature",
"properties":{
"id":1376628261,
"owner":"62311807@N05",
"secret":"f9a4598e7d",
"server":5109,
"farm":6,
"title":"Relax.",
"accuracy":11,
"place_id":"_cv6vY5WV7_DBdU",
"woeid":755126,
"translated":"Relax ",
"tags":"",
"date_taken":"2010/07/22",
"url":"http://www.flickr.com/photos/
62311807@N05/5671595557/",
"description":"",
"photo_url":"http://farm6.static.flickr.com/
5109/5671595557_f9a4598e7d_z.jpg",
"date_inserted":"2011/07/24"
},
"geometry":{
"type":"Point",
"coordinates":[-3.293151,
36.940974
]
}
}
]
}

On Aug 1, 2:01 pm, Adam Estrada estrada.a...@gmail.com wrote:

All,

It's relatively simple to getspatialdata from Postgres. The
following example is geojson exported directly from Postgis.

http://pastebin.com/25NsAteH

What would I have to do to bulk load the data in to ES?

Thanks in advance,
Adam


(system) #6