How can I use elasticsearch-river-mongodb to search more collections?


(lsx) #1

Hi.
I use the elasticsearch-river-mongodb plugin with elasticsearch-0.19.2, now
I have some collections with mongodb:
person, post, comment.

Then, I use these:
curl -XPUT "localhost:9200/_river/mongodb/_meta" -d '
{
type: "mongodb",
mongodb: {
db: "myblog",
host: "127.0.0.1",
port: 27017,
collection: "person"
},
index: {
name: "person",
type: "person"
}
}'
curl -XPUT "localhost:9200/_river/mongodb/_meta" -d '
{
type: "mongodb",
mongodb: {
db: "myblog",
host: "127.0.0.1",
port: 27017,
collection: "post"
},
index: {
name: "post",
type: "post"
}
}'
curl -XPUT "localhost:9200/_river/mongodb/_meta" -d '
{
type: "mongodb",
mongodb: {
db: "myblog",
host: "127.0.0.1",
port: 27017,
collection: "comment"
},
index: {
name: "comment",
type: "comment"
}
}'

Then, I use java to test it:
Node node = nodeBuilder().node();
Client client = node.client();
InternalSearchResponse response = client.prepareSearch("person")
.setQuery(termQuery("_all", "myname"))
.setFrom(0).setSize(10).setExplain(true)
.execute()
.actionGet();

It can get the response, it works good.

But then, I test the post and the comment:
Node node = nodeBuilder().node();
Client client = node.client();
InternalSearchResponse response = client.prepareSearch("post")
.setQuery(termQuery("_all", "mypost"))
.setFrom(0).setSize(10).setExplain(true)
.execute()
.actionGet();

It say the index missing. (org.elasticsearch.indices.IndexMissingException:
[post] missing), and I see the dir, there is a dir named "person", but no
"post" or "comment". I see only the first operation can work good.

So what am I missing or did wrong please?
Thanks a lot. :slight_smile:

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/How-can-I-use-elasticsearch-river-mongodb-to-search-more-collections-tp3913769p3913769.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #2