Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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