Skip to main content

Integrating Elastic Search With Mongodb Using No-SQL



An insight about search engine:
An application which provides the searched results of documents over the web for some itemized keywords. Here a series of document are found out which contains those specified keywords. Moreover, search engine is a pack of programs usually framed to be the Systems.
More often than, Web Search engines perform its work by transmitting the data packets to retrieve the maxim amount of docs. Then an Indexer goes through these documents and formulates an Index depending on word count for every document. Several search engines use a varied algorithm to build Indices in such a way that uniquely worthy outcome is delivered to each & every query.
Elastic search, Bobo Search, Index Tank, Apache Solr, Summa, Compass, Katta, Constellio ETC. are some of the search engines which are available in the Market. Also, every search engine has their own idiosyncrasy.

An insight about Elastic search:

Elastic Search is an immensely extensive Open Source search designed for nearly real-time search. It helps you to think through Herculean sized data. Elastic search is a type of distributed one. It indicates that each index can further be split into Shards and those themselves can have their many clones or none. Basic concepts of elastic search are NRTClusterNodeIndexTypeDocumentShards & Replicas.

First of all download and install both the MongoDB and Elastic Search.
MongoDB runs on 27017 and Elastic Search on 9200

Introduction to the integration of MongoDB and Elastic search:

Maneuvering over furthermore you have to grab your attention on versions of varied elements. The synthesis of Elastic Search with MongoDB through a River plugin is liable to transferring the flow of data.

Addition Of Plugins Considering The Suitable Version:

NOTE: Please Refer MongoDB site Blog Page.

Execute that command in terminal:

bin/plugin --install mobz/elasticsearch-head
bin/plugin --install elasticsearch/elasticsearch-mapper-attachments/2.4.3
bin/plugin --install com.github.richardwilly98.elasticsearch/elasticsearch-river-mongodb/2.0.6
Once you install River plugin thereafter you have to start elasticsearch.bat file which is accessible in elastic search bin folder.
To view River MongoDB plugin you need to give the URL in the browser:
http://www.example.com:9200/_plugin/river-mongodb/
http://www.example.com:9200/_plugin/head/

Configuring MongoDB

The only way to connect MongoDB and Elastic Search by exporting and then importing the data into the Elastic Search with the usage of the replication of the system of MongoDB.
For a more detailed description here you will find complete instructions related to create MongoDB replica.
A thorough description with complete instructions corresponding to the making of MongoDB and elastic search is provided as follows.

Create a new index running river:Syntax:

curl -XPUT "localhost:9200/_river/river_name/_meta" -d '
{
"type": "mongodb",
"mongodb": {
"servers": [
{ "host": "localhost", "port": 30001}
],
"options": { "secondary_read_preference": true },
"db": "db_name",
"collection": "collection_name"
},
"index": {
"name": " index_name",
"type": " index_type"
}
}'

Write the db Name, collection Name, index name , index type:

Example:
curl -XPUT "localhost:9200/_river/student_info/_meta" -d '
{
"type": "mongodb",
"mongodb": {
"servers": [
{ "host": "localhost", "port": 30001 }
],
"options": { "secondary_read_preference": true },
"db": "studentDB",
"collection": "studentColl"
},
"index": {
"name": "studentIndex1",
"type": "studentType2"
}
}'

View index data in elastic search:

Syntax:
http://www.example.com:9200/indexname/indextype/_search?preety
e.g
http://www.example.com:9200/studentIndex1/studentType2/_search?preety

View specific index detail by “id”:

 Syntax:
http://www.example.com:9200/indexname/indextype/id 
Discussion had been carried out about “How to integrate Elastic Search and MongoDB ?”. Store large amount of schema-less data in mongoDB development and make data analytic and full text search using Elastic Search. MongoDB providing a big data solution for large enterprise application.




Comments

Popular posts from this blog

Learn Nodejs

My favorite resource is "nodeschool.io!" "Install these choose-your-own-adventure style lessons and learn how to use node.js, npm and other related tools by writing code to solve realistic problems. The lessons run in your terminal and work on Windows, Mac and Linux."   Tutorials Hello World Hello World Web Server Node.js guide Build a blog with Node.js, express and mongodb Node.Js Tutorials At Project 70 Node.js for Beginners Learn Node.js Completely and with Confidence Videos Node tuts Introduction to Node.js with Ryan Dahl Node.js: Asynchronous Purity Leads to Faster Development Parallel Programming with Node.js Server-side JavaScript with Node, Connect & Express Node.js First Look Node.js with MongoDB Ryan Dahl's Google Tech Talk Screencasts Learn All The Nodes NodeTuts NodeCasts Books " The Node Beginner Book Mastering Node.js Up and Running with Node.js Node.js in Action Smashing Node.js: JavaScript Ev...

mynodejs

Event-driven programming can be overwhelming for beginners, which can make Node.js  difficult to get started with. But don't let that discourage you; In this article, I will teach you some of the basics of  Node.js  and explain why it has become so popular. Asynchronous Programming Node.js  uses a module architecture to simplify the creation of complex applications. Chances are good that you are familiar with asynchronous programming; it is, after all, the "A" in Ajax. Every function in  Node.js  is asynchronous. Therefore, everything that would normally block the thread is instead executed in the background. This is the most important thing to remember about  Node.js . For example, if you are reading a file on the file system, you have to specify a callback function that is executed when the read operation has completed. You are Doing Everything! Node.js  is only an environment - meaning that you have to do everything yourself. There...