Skip to content

Instantly share code, notes, and snippets.

@gonvaled
Created April 20, 2012 14:41
Show Gist options
  • Save gonvaled/2429165 to your computer and use it in GitHub Desktop.
Save gonvaled/2429165 to your computer and use it in GitHub Desktop.
Setup elasticsearch index with two couchdb rivers
#!/bin/bash
server="localhost:9200"
index="my_index"
river1="first_river"
host1="localhost"
port1="5984"
db1="firstdb"
type1="firsttype"
river2="secondriver"
host2="localhost"
port2="5984"
db2="seconddb"
type2="secondtype"
configure_rivers_ ( ) {
curl -XPUT "$server/_river/$river1/_meta" -d "
{
\"type\" : \"couchdb\",
\"couchdb\" : {
\"host\" : \"$host1\",
\"port\" : $port1,
\"db\" : \"$db1\",
\"filter\" : null
},
\"index\" : {
\"index\" : \"$index\",
\"type\" : \"$type1\",
\"bulk_size\" : \"100\",
\"bulk_timeout\" : \"10ms\"
}
}"
curl -XPUT "$server/_river/$river2/_meta" -d "
{
\"type\" : \"couchdb\",
\"couchdb\" : {
\"host\" : \"$host2\",
\"port\" : $port2,
\"db\" : \"$db2\",
\"filter\" : null
},
\"index\" : {
\"index\" : \"$index\",
\"type\" : \"$type2\",
\"bulk_size\" : \"100\",
\"bulk_timeout\" : \"10ms\"
}
}"
}
get_rivers_ ( ) {
curl -XGET "$server/_river/$river1/_meta"
curl -XGET "$server/_river/$river2/_meta"
}
#configure_rivers_
get_rivers_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment