-
Notifications
You must be signed in to change notification settings - Fork 2
Working ES Docker setup
Thomas Ringling edited this page Jan 18, 2015
·
1 revision
ES 1.4.x and the river plugin for ES 1.4(=>2.4.1), do not work right now. We hence stick to ES < 1.4, namely ES 1.3.7 & plugin 2.3.0
Elasticsearch download CouchDB river plugin
docker run -i -t ubuntu /bin/bash
apt-get update
apt-get install -y vim curl wget
# Install Java
apt-get install openjdk-7-jre-headless --yes
# Install ES
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.7.deb
dpkg -i elasticsearch-1.3.7.deb
# Install CouchDB river plugin
service elasticsearch stop
/usr/share/elasticsearch/bin/plugin -install elasticsearch/elasticsearch-river-couchdb/2.3.0
service elasticsearch start
# Start instance
docker run -i -p 9200:9200 -p 9300:9300 -t es_1_3_7 /bin/bash
We create indeces. ES synchronizes the data CouchDB itself itself, via the river plugin
curl -X PUT '127.0.0.1:9200/_river/postal_codes/_meta' -d '{
"type" : "couchdb",
"couchdb" : { "host" : "178.62.225.168", "port" : 5984, "db" : "postal_codes", "filter" : null },
"index" : { "index" : "postal_codes", "type" : "postal_code", "bulk_size" : "100", "bulk_timeout" : "10ms" }
}'
# Test the created index
curl 127.0.0.1:9200/postal_codes/postal_code/2850?pretty=truecurl -X PUT '127.0.0.1:9200/_river/postal_districts/_meta' -d '{
"type" : "couchdb",
"couchdb" : { "host" : "178.62.225.168", "port" : 5984, "db" : "postal_districts", "filter" : null },
"index" : { "index" : "postal_districts", "type" : "postal_district", "bulk_size" : "100", "bulk_timeout" : "10ms" }
}'
# Test the created index
curl sofa-staging.lokalebasen.dk:9200/postal_districts/postal_district/2850?pretty=truecurl -X PUT '178.62.225.168:9200/_river/dk_locations/_meta' -d '{
"type" : "couchdb",
"couchdb" : { "host" : "178.62.225.168", "port" : 5984, "db" : "dk_locations", "filter" : null },
"index" : { "index" : "dk_locations", "type" : "location", "bulk_size" : "100", "bulk_timeout" : "10ms" }
}'GET /dk_locations/location/_search
{
"size" : 0,
"aggs": {
"all_postal_codes": {
"terms": {
"size" : 2000, # should exceed the number of total postal codes
"field": "postal_code"
}
}
}
}GET /dk_locations/location/_search
{
"query": {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"geo_distance" : {
"distance" : "300m",
"location.location" : {
"lat" : 55.819067,
"lon" : 12.530201
}
}
}
}
}
}