I am fairly new to both mongodb and node.js but recently got everything to work well for me until I reached the point where I needed to add a full text search to my website. From my research I figured out that Elasticsearch would be a good fit, but I couldnt figure out exactly how to get it to work with node.js and mongodb. I am currently using Heroku and MongoLab to host my application. Here are my questions.
How do I host Elasticsearch?
How do I make all my mongo data available to elasticsearch do I use a river or do I manually inset and delete all data?
I found something this river but I am not quite sure how to make this happen automatically and where to host it.
How do I query Elasticsearch from node.js? Is there a package that allows for this?
Edit:
Question 2 is really what I am struggling with. I have also included question 1 and 3 to help people that are new to the topic and coming from google.
1) either on your own server/VM/whatever.. or with a hosted service such as https://searchbox.io/
2) you can create a script to index your existing data and then index new data once its created, or use a river to index your current database.
3) ElasticSearch is a simple HTTP API, you can make your own requests using the 'http' module or simplify it with something like https://github.com/mikeal/request
you can also use a 3rd party library like https://github.com/phillro/node-elasticsearch-client
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With