# Index postgreSQL to elasticsearch

**URL:** <https://discuss.elastic.co/t/index-postgresql-to-elasticsearch/25345>\
**Category:** Elasticsearch\
**Created:** [July 10, 2015, 6:52pm UTC](https://discuss.elastic.co/t/index-postgresql-to-elasticsearch/25345 "2015-07-10T18:52:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![GG8](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@GG8](https://discuss.elastic.co/u/GG8)\
**Post date:** [July 10, 2015, 6:52pm UTC](https://discuss.elastic.co/t/index-postgresql-to-elasticsearch/25345/1 "2015-07-10T18:52:44Z")

</div>

any tips on how to index postgreSQL to elasticsearch, i followed

[http://blog.comperiosearch.com/blog/2014/01/30/elasticsearch-indexing-sql-databases-the-easy-way/](http://blog.comperiosearch.com/blog/2014/01/30/elasticsearch-indexing-sql-databases-the-easy-way/)

by installing

> **[jprante/elasticsearch-jdbc](https://github.com/jprante/elasticsearch-jdbc)**
>
> elasticsearch-jdbc - JDBC importer for Elasticsearch

and see below error

curl: (6) Couldn't resolve host 'id,date\_time,status,step,process,service\_name,host\_name,app\_name'  
curl: (6) Couldn't resolve host 'from'  
curl: (6) Couldn't resolve host 'activity\_monitor\_transaction'  
curl: (6) Couldn't resolve host 'where'  
curl: (6) Couldn't resolve host 'date\_time'

here is the curl command

curl -XPUT "[http://localhost:9200/\_river/actmon/\_meta](http://localhost:9200/_river/actmon/_meta)" -d'  
{  
"type": "jdbc",  
"jdbc": {  
"driver": "org.postgresql.Driver",  
"url": "jdbc:postgresql://xxxx:5432/aicpgsd",  
"user": "actmon",  
"password": "atmp95",  
"index": "actmon",  
"type": "actmon",  
"sql": "select id,date\_time,status,step,process,service\_name,host\_name,app\_name from activity\_monitor\_transaction  
where date\_time BETWEEN '2015-07-01' AND '2015-07-10'"  
}  
}'

---

<div class="post-metadata">

**Author:** ![travagini](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@travagini](https://discuss.elastic.co/u/travagini)\
**Post date:** [July 10, 2015, 7:03pm UTC](https://discuss.elastic.co/t/index-postgresql-to-elasticsearch/25345/2 "2015-07-10T19:03:11Z")

</div>

It seems your curl is not working. Have you tried to do something like curl http:www.google.com ?  
Try this to check if curl is fine.

---

<div class="post-metadata">

**Author:** ![GG8](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@GG8](https://discuss.elastic.co/u/GG8)\
**Post date:** [July 10, 2015, 7:10pm UTC](https://discuss.elastic.co/t/index-postgresql-to-elasticsearch/25345/3 "2015-07-10T19:10:16Z")

</div>

curl is fine, i am able to load some json file but not this particular one

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 10, 2015, 8:01pm UTC](https://discuss.elastic.co/t/index-postgresql-to-elasticsearch/25345/4 "2015-07-10T20:01:19Z")

</div>

Are you running on Windows?

---

<div class="post-metadata">

**Author:** ![GG8](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@GG8](https://discuss.elastic.co/u/GG8)\
**Post date:** [July 10, 2015, 8:02pm UTC](https://discuss.elastic.co/t/index-postgresql-to-elasticsearch/25345/5 "2015-07-10T20:02:42Z")

</div>

no on linux

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [July 10, 2015, 8:25pm UTC](https://discuss.elastic.co/t/index-postgresql-to-elasticsearch/25345/6 "2015-07-10T20:25:58Z")

</div>

Your JSON is invalid for the shell. Check the apostrophes/single quotes in the SQL. They conflict with shell and curl `-d` parameter. Please use shell escape.

---

<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:02am UTC](https://discuss.elastic.co/t/index-postgresql-to-elasticsearch/25345/7 "2017-07-06T00:02:13Z")

</div>


