Skip to content

Instantly share code, notes, and snippets.

@nz
Created February 12, 2012 23:34
Show Gist options
  • Save nz/1811845 to your computer and use it in GitHub Desktop.
Save nz/1811845 to your computer and use it in GitHub Desktop.
Getting started with Bonsai.io's hosted ElasticSearch service
$ heroku addons:add elasticsearch:test
-----> Adding elasticsearch:test to bonsai-search... done, v51 (free)
$ heroku config | grep ELASTICSEARCH_URL
ELASTICSEARCH_URL => http://index.bonsai.io/pw4mw3d5y1rql88i44eo
$ curl 'http://index.bonsai.io/pw4mw3d5y1rql88i44eo/test?pretty=true' -d '{"test":"hello world"}'
{
"ok":true,
"_index":"pw4mw3d5y1rql88i44eo",
"_type":"test",
"_id":"qKdnxB14R7OYTmiCdK2g2A",
"_version":1
}
$ curl 'http://index.bonsai.io/pw4mw3d5y1rql88i44eo/test/_search?q=test:hello&pretty=true'
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.19178301,
"hits" : [ {
"_index" : "pw4mw3d5y1rql88i44eo",
"_type" : "test",
"_id" : "qKdnxB14R7OYTmiCdK2g2A",
"_score" : 0.19178301, "_source" : {"test":"hello world"}
} ]
}
}
@fizx
Copy link

fizx commented Feb 12, 2012

ELASTICSEARCH_URL or BONSAI_URL, etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment