Skip to content

Build a Real-time search engine using node.js, Vue.js and Elasticsearch

Notifications You must be signed in to change notification settings

samuelayo/elastic-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-time Search Engine with Node.js, Vue.js and Elasticsearch

Getting Started

  • Clone this repo
git clone https://github.com/samuelayo/elastic-node.git


  • change directory into the newly cloned repo
cd elastic-node
  • Install required node.js libraries
npm install

Now the first part of your environment is set up. However, elasticsearch itself is missing from your setup. You will need to install elasticsearch itself. There are different ways to install Elastic search. If you are using a debian linux operating system, you could just download the .deb file and install using dpkg.

//download the deb package
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.4.deb
//install the deb package using dpkg
sudo dpkg -i elasticsearch-5.6.4.deb

For other distributions/operating systems, you can find a guide on how to install elasticsearch here Elasticsearch is not started automatically after installation. Elasticsearch can be started and stopped using the service command:

sudo -i service elasticsearch start
sudo -i service elasticsearch stop

To configure Elasticsearch to start automatically when the system boots up, run the following commands:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

After running the above command, Elasticsearch can be started and stopped as follows:

sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service

To check the status of Elasticsearch:

sudo service elasticsearch status

Solving CORS issue

To solve this issue, locate your Elasticsearch config file (For Debian/ubuntu, it can be found at /etc/elasticsearch/elasticsearch.yml. For other operating systems, find out where it is located here) and add the following to the bottom of the file:**

http.cors.enabled : true
http.cors.allow-origin : "*"

After that is done, restart your elasticsearch instance

sudo service elasticsearch restart

Test the DEMO

  • Serve the app
node index.js
  • Test the Server side search Navigate to http://localhost:3001/

  • Test the Client side Search Navigate to http://localhost:3001/v2

About

Build a Real-time search engine using node.js, Vue.js and Elasticsearch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published