# INSTALL ElasticSearch
curl -k -L -# -o elasticsearch-0.16.2.tar.gz \
      "http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.16.2.tar.gz"
tar -zxf elasticsearch-0.16.2.tar.gz
rm -f elasticsearch-0.16.2.tar.gz

# INSTALL Couchdb River
./elasticsearch-0.16.2/bin/plugin -install river-couchdb

# Start ElasticSearch
./elasticsearch-0.16.2/bin/elasticsearch -p #{destination_root}/tmp/pids/elasticsearch.pid

# Couchdb App Database (couchdb_myapp_development)
curl -vX PUT 'http://127.0.0.1:5984/couchdb_myapp_development'

# Create river index
curl -XPUT 'http://localhost:9200/_river/couchdb_myapp_development_river/_meta' -d '{
    "type" : "couchdb",
    "couchdb" : {
        "host" : "localhost",
        "port" : 5984,
        "db" : "couchdb_myapp_development",
        "filter" : null
    }
}'