Dead simple search engine for huge a text file (> 1 million lines), powered by elasticsearch.
Usually used to search for files by names if you have million of files in file system.
- docker
- docker-compose
- Node.js 10+
git clone https://github.com/soruly/search.git
cd search
npm installCopy .env.example and rename to .env
ES_JAVA_OPTS=-Xms512m -Xmx512m # elasticsearch java options, ram usage config
ELASTICSEARCH_PORT=9201 # you can access elasticsearch from host, for debug use
NODE_PORT=8001 # web interface would listen to this port
FILE_LIST=/tmp/list.txt # a huge text file to index
For example, generate a filename list
find . > /tmp/list.txtdocker-compose up -dcurl http://127.0.0.1:8001/updateIndex update usually takes 90 seconds for 2 million records
Now open the webpage http://127.0.0.1:8001
Note: existing index would be wiped everytime on update
You can schedule a cron job to periodically update the index
0 * * * * find . > /tmp/list.txt && curl http://127.0.0.1:8001/update