How to index the Google Geocode


(Ritesh) #1

I Have google Geocode API, which works well with JSON response, here is the GET

curl -XGET https://maps.googleapis.com/maps/api/geocode/json?address=USA

here is the response

{
"results" : [
{
"address_components" : [
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "United States",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 71.3867745,
"lng" : -66.885417
},
"southwest" : {
"lat" : 18.9110642,
"lng" : 172.4458955
}
},
"location" : {
"lat" : 37.09024,
"lng" : -95.712891
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 49.38,
"lng" : -66.94
},
"southwest" : {
"lat" : 25.82,
"lng" : -124.39
}
}
},
"place_id" : "ChIJCzYy5IS16lQRQrfeQ5K5Oxw",
"types" : [ "country", "political" ]
}
],
"status" : "OK"
}

Now i want to index the same thing in ES, how can I do that.
Also I want to index multiple countries and not just USA

I was trying something like this below, but its not working

curl -XPOST http://localhost:9200/country/address/ -d "{https://maps.googleapis.com/maps/api/geocode/json?address=USA}"


(Mark Walkom) #2

The -d option for curl expects a file, not a URL.
It might be easier if you get that data, save it to a file and then upload it to ES.


(Ritesh) #3

Thanks Mark
Does logstash allows to read URL?, i search for plugin but didn't found

Please let me know if you aware of as such any

Thanks


(Mark Walkom) #4

No, you cannot do that with LS.


(system) #5