I already have MongoDB and installed Elasticsearch with Mongoriver . So I created my river:
$ curl -X PUT localhost:9200/_river/database_test/_meta -d '{ "type": "mongodb", "mongodb": { "servers": [ { "host": "127.0.0.1", "port": 27017 } ], "options": { "secondary_read_preference": true }, "db": "database_test", "collection": "event" }, "index": { "name": "database_test", "type": "event" } }'
I just want to receive events from country:Canada , so I'm trying:
$ curl -XGET 'http://localhost:9200/database_test/_search?q=country:Canada'
And I get:
{ "took": 2, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 0, "max_score": null, "hits": [] } }
I am searching the web and I read that I must first index my collection with Elasticsearch (lost link). Should I index my mongod? What to do to get results from an existing MongoDB collection?
mongodb elasticsearch
Diolor
source share