# How to index the Google Geocode

**URL:** <https://discuss.elastic.co/t/how-to-index-the-google-geocode/23799>\
**Category:** Elasticsearch\
**Created:** [June 17, 2015, 4:53am UTC](https://discuss.elastic.co/t/how-to-index-the-google-geocode/23799 "2015-06-17T04:53:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)\
**Post date:** [June 17, 2015, 4:53am UTC](https://discuss.elastic.co/t/how-to-index-the-google-geocode/23799/1 "2015-06-17T04:53:10Z")

</div>

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](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/](http://localhost:9200/country/address/) -d "{[https://maps.googleapis.com/maps/api/geocode/json?address=USA](https://maps.googleapis.com/maps/api/geocode/json?address=USA)}"

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 17, 2015, 5:16am UTC](https://discuss.elastic.co/t/how-to-index-the-google-geocode/23799/2 "2015-06-17T05:16:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)\
**Post date:** [June 17, 2015, 6:13am UTC](https://discuss.elastic.co/t/how-to-index-the-google-geocode/23799/3 "2015-06-17T06:13:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 17, 2015, 6:25am UTC](https://discuss.elastic.co/t/how-to-index-the-google-geocode/23799/4 "2015-06-17T06:25:48Z")

</div>

No, you cannot do that with LS.

---

<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, 12:07am UTC](https://discuss.elastic.co/t/how-to-index-the-google-geocode/23799/5 "2017-07-06T00:07:06Z")

</div>


