CouchDB river not working out of the box


(martinthenext) #1

I beg your pardon for such a newbie question, but elasticsearch
website states getting search running should be easy, so I've decided
to try and use it with CouchDB. Following website instuctions on every
step, I've ran into a IndexMissingException. Here's a complete
description of what I've done:

Check if couchdb works:

dufft@ubuntu:~$ curl -X GET http://localhost:5984
{"couchdb":"Welcome","version":"1.0.1"}

Check if elasticsearch works:

dufft@ubuntu:~$ curl -X GET http://localhost:9200
{
[...]
}

Create a CouchDB database (named my_couch_db) for indexing (or use an
existing one)

curl -X PUT http://localhost:5984/my_couch_db
{"ok":true}

Enable the couchdb-river plugin in ElasticSearch

dufft@ubuntu:~$ cd elasticsearch/
dufft@ubuntu:~/elasticsearch$ ./bin/plugin -install river-couchdb
-> Installing river-couchdb Downloading plugin from
http://elasticsearch.googlecode.com/svn/plugins/river-couchdb/elasticsearch-river-couchdb-0.15.2.zip
... DONE

Configure ElasticSearch to start indexing

dufft@ubuntu:~/elasticsearch$ cat configure-indexing.sh
curl -XPUT 'http://localhost:9200/_river/my_es_idx/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "my_couch_db",
"filter" : null
}
}'
dufft@ubuntu:~/elasticsearch$ ./configure-indexing.sh
{"ok":true,"_index":"_river","_type":"my_es_idx","_id":"_meta","_version":
4}duff

That’s it. We are ready to go. You can query ElasticSearch for the
couchdb data at http://elasticsearch-host:9200/my_couch_db/my_couch_db.

Creating a new document in my_couch_db database:

dufft@ubuntu:~$ cat data.json
{
"user" : "dufft",
"text" : "some data here"
}
dufft@ubuntu:~$ curl -X PUT http://localhost:5984/my_couch_db/text1 -d
@data.json
{"ok":true,"id":"text1","rev":"1-a894aaef73fb81c5d0a2d1eb1fbd7532"}
dufft@ubuntu:~$ curl -X GET http://localhost:5984/my_couch_db/text1
{"_id":"text1","_rev":"1-
a894aaef73fb81c5d0a2d1eb1fbd7532","user":"dufft","text":"some data
here"}

Now querying using 'request body':

dufft@ubuntu:~$ cat sample-query-1
{
"query" : {
"term" : { "user" : "dufft" }
}
}

dufft@ubuntu:~$ url -X GET http://localhost:9200/my_couch_db/my_couch_db/_search
-d @sample-query-1
{"error":"[[my_couch_db] missing]","status":404}

As you can see, I've followed instructions on
http://www.elasticsearch.org/tutorials/2010/08/01/couchb-integration.html
and http://www.elasticsearch.org/guide/reference/api/search/ for
couchdb and search. What am I doing wrong?


(IvanBrusic) #2

You named your index "my_es_idx", but are querying on the
"my_couch_db" index. The name is set either in the PUT request
"http://localhost:9200/_river/my_es_idx/_meta" or overriden in the
"index" section of the JSON (http://www.elasticsearch.org/guide/
reference/river/couchdb.html)

Ivan

On Apr 3, 4:14 am, martinthenext martin.davt...@gmail.com wrote:

I beg your pardon for such a newbie question, but elasticsearch
website states getting search running should be easy, so I've decided
to try and use it with CouchDB. Following website instuctions on every
step, I've ran into a IndexMissingException. Here's a complete
description of what I've done:

Check if couchdb works:

dufft@ubuntu:~$ curl -X GEThttp://localhost:5984
{"couchdb":"Welcome","version":"1.0.1"}

Check if elasticsearch works:

dufft@ubuntu:~$ curl -X GEThttp://localhost:9200
{
[...]

}

Create a CouchDB database (named my_couch_db) for indexing (or use an
existing one)

curl -X PUThttp://localhost:5984/my_couch_db
{"ok":true}

Enable the couchdb-river plugin in ElasticSearch

dufft@ubuntu:~$ cd elasticsearch/
dufft@ubuntu:~/elasticsearch$ ./bin/plugin -install river-couchdb
-> Installing river-couchdb Downloading plugin fromhttp://elasticsearch.googlecode.com/svn/plugins/river-couchdb/elastic...
... DONE

Configure ElasticSearch to start indexing

dufft@ubuntu:~/elasticsearch$ cat configure-indexing.sh
curl -XPUT 'http://localhost:9200/_river/my_es_idx/_meta'-d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "my_couch_db",
"filter" : null
}}'

dufft@ubuntu:~/elasticsearch$ ./configure-indexing.sh
{"ok":true,"_index":"_river","_type":"my_es_idx","_id":"_meta","_version":
4}duff

That’s it. We are ready to go. You can query ElasticSearch for the
couchdb data athttp://elasticsearch-host:9200/my_couch_db/my_couch_db.

Creating a new document in my_couch_db database:

dufft@ubuntu:~$ cat data.json
{
"user" : "dufft",
"text" : "some data here"}

dufft@ubuntu:~$ curl -X PUThttp://localhost:5984/my_couch_db/text1-d
@data.json
{"ok":true,"id":"text1","rev":"1-a894aaef73fb81c5d0a2d1eb1fbd7532"}
dufft@ubuntu:~$ curl -X GEThttp://localhost:5984/my_couch_db/text1
{"_id":"text1","_rev":"1-
a894aaef73fb81c5d0a2d1eb1fbd7532","user":"dufft","text":"some data
here"}

Now querying using 'request body':

dufft@ubuntu:~$ cat sample-query-1
{
"query" : {
"term" : { "user" : "dufft" }
}

}

dufft@ubuntu:~$ url -X GEThttp://localhost:9200/my_couch_db/my_couch_db/_search
-d @sample-query-1
{"error":"[[my_couch_db] missing]","status":404}

As you can see, I've followed instructions onhttp://www.elasticsearch.org/tutorials/2010/08/01/couchb-integration....
andhttp://www.elasticsearch.org/guide/reference/api/search/for
couchdb and search. What am I doing wrong?


(martinthenext) #3

Thanks, Ivan!

I've tried to change _meta settings, but search query still returns an
error, now a different one.

dufft@ubuntu:~$ cat settings

{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "my_couch_db",
"filter" : null
},
"index" : {
"index" : "my_couch_db",
"type" : "my_couch_db",
"bulk_size" : "100",
"bulk_timeout" : "10ms"
}
}

curl -X PUT http://localhost:9200/_river/my_couch_db/_meta -d
@settings

{"ok":true,"_index":"_river","_type":"my_couch_db","_id":"_meta","_version":
1}

curl -X GET http://localhost:9200/my_couch_db/my_couch_db/_search -d
@sample-query-1

{"error":"SearchPhaseExecutionException[Failed to execute phase
[query], total failure; shardFailures {[It7yw-F7QBWTPLEUn6TJzg]
[my_couch_db][0]: QueryPhaseExecutionException[[my_couch_db][0]:
query[user:dufft],from[0],size[10]: Query Failed [Failed to execute
main query]]; nested: TypeMissingException[[my_couch_db]
type[my_couch_db] missing]; }{[It7yw-F7QBWTPLEUn6TJzg][my_couch_db]
[1]: QueryPhaseExecutionException[[my_couch_db][1]:
query[user:dufft],from[0],size[10]: Query Failed [Failed to execute
main query]]; nested: TypeMissingException[[my_couch_db]
type[my_couch_db] missing]; }{[It7yw-F7QBWTPLEUn6TJzg][my_couch_db]
[2]: QueryPhaseExecutionException[[my_couch_db][2]:
query[user:dufft],from[0],size[10]: Query Failed [Failed to execute
main query]]; nested: TypeMissingException[[my_couch_db]
type[my_couch_db] missing]; }{[It7yw-F7QBWTPLEUn6TJzg][my_couch_db]
[3]: QueryPhaseExecutionException[[my_couch_db][3]:
query[user:dufft],from[0],size[10]: Query Failed [Failed to execute
main query]]; nested: TypeMissingException[[my_couch_db]
type[my_couch_db] missing]; }{[It7yw-F7QBWTPLEUn6TJzg][my_couch_db]
[4]: QueryPhaseExecutionException[[my_couch_db][4]:
query[user:dufft],from[0],size[10]: Query Failed [Failed to execute
main query]]; nested: TypeMissingException[[my_couch_db]
type[my_couch_db] missing]; }]","status":500}

What does this suppose to mean? Any suggestions?

On Apr 3, 9:24 pm, Ivan Brusic ivan_bru...@yahoo.com wrote:

You named your index "my_es_idx", but are querying on the
"my_couch_db" index. The name is set either in the PUT request
"http://localhost:9200/_river/my_es_idx/_meta" or overriden in the
"index" section of the JSON (http://www.elasticsearch.org/guide/
reference/river/couchdb.html)

Ivan

On Apr 3, 4:14 am, martinthenext martin.davt...@gmail.com wrote:

I beg your pardon for such a newbie question, but elasticsearch
website states getting search running should be easy, so I've decided
to try and use it with CouchDB. Following website instuctions on every
step, I've ran into a IndexMissingException. Here's a complete
description of what I've done:

Check if couchdb works:

dufft@ubuntu:~$ curl -X GEThttp://localhost:5984
{"couchdb":"Welcome","version":"1.0.1"}

Check if elasticsearch works:

dufft@ubuntu:~$ curl -X GEThttp://localhost:9200
{
[...]

}

Create a CouchDB database (named my_couch_db) for indexing (or use an
existing one)

curl -X PUThttp://localhost:5984/my_couch_db
{"ok":true}

Enable the couchdb-river plugin in ElasticSearch

dufft@ubuntu:~$ cd elasticsearch/
dufft@ubuntu:~/elasticsearch$ ./bin/plugin -install river-couchdb
-> Installing river-couchdb Downloading plugin fromhttp://elasticsearch.googlecode.com/svn/plugins/river-couchdb/elastic...
... DONE

Configure ElasticSearch to start indexing

dufft@ubuntu:~/elasticsearch$ cat configure-indexing.sh
curl -XPUT 'http://localhost:9200/_river/my_es_idx/_meta'-d'{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "my_couch_db",
"filter" : null
}}'

dufft@ubuntu:~/elasticsearch$ ./configure-indexing.sh
{"ok":true,"_index":"_river","_type":"my_es_idx","_id":"_meta","_version":
4}duff

That’s it. We are ready to go. You can query ElasticSearch for the
couchdb data athttp://elasticsearch-host:9200/my_couch_db/my_couch_db.

Creating a new document in my_couch_db database:

dufft@ubuntu:~$ cat data.json
{
"user" : "dufft",
"text" : "some data here"}

dufft@ubuntu:~$ curl -X PUThttp://localhost:5984/my_couch_db/text1-d
@data.json
{"ok":true,"id":"text1","rev":"1-a894aaef73fb81c5d0a2d1eb1fbd7532"}
dufft@ubuntu:~$ curl -X GEThttp://localhost:5984/my_couch_db/text1
{"_id":"text1","_rev":"1-
a894aaef73fb81c5d0a2d1eb1fbd7532","user":"dufft","text":"some data
here"}

Now querying using 'request body':

dufft@ubuntu:~$ cat sample-query-1
{
"query" : {
"term" : { "user" : "dufft" }
}

}

dufft@ubuntu:~$ url -X GEThttp://localhost:9200/my_couch_db/my_couch_db/_search
-d @sample-query-1
{"error":"[[my_couch_db] missing]","status":404}

As you can see, I've followed instructions onhttp://www.elasticsearch.org/tutorials/2010/08/01/couchb-integration....
andhttp://www.elasticsearch.org/guide/reference/api/search/for
couchdb and search. What am I doing wrong?


(system) #4