Based on:
- How To Build a Real-time Search Engine With Node, Vue, and ElasticSearch by Ogundipe Samuel Ayo
- Originally Posted December 12, 2019
Changes:
-
TypeScript
-
Docker for ElasticSearch engine
-
Server
- Elastic search from Docker container
- Express JS
-
Client
- Vue (sorta)
-
Data
- city list in /Data directory
- Clone or download this repository
git clone https://github.com/diberry/elastic-search-express
cd elastic-search-express- move into directory just creatednpm installto install dependencies
If you don't have an ElasticSearch server yet, you can use it from a Docker container.
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.8.1to bring image down to local computerdocker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.8.1to start containerdocker psto see if container is running
- curl -X GET "localhost:9200/_cat/nodes?v&pretty"
This is a one-time action to load city list into ElasticSearch index.
npm run load_data
npm run prebuildto prep directoriesnpm run buildto transpile typescript into javascript into/distfolder
npm run opento open browser to http://localhost:3001npm run start
npm run start:all:again- assumes data is loaded and you just need to prebuilt, build, start, and open in browser
http://localhost:3001/?search=a- all cities beginning with the letter a
When you query, there is no visual indicator blocking UI - just wait...