Skip to content

spinscale/social-network-search-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Svelte sample social network

NOTE:: DO NOT RUN THIS IN PRODUCTION AS IT IS INSECURE

This is a quick PoC, that uses Elasticsearch to store very few documents and demo some different queries to retrieve data.

You can find the corresponding blog post at https://spinscale.de/posts/2020-05-29-implementing-a-linkedin-like-search-as-you-type-with-elasticsearch.html

In order to get up and running run

npm install
npm run dev

You need Elasticsearch up and running as well

# https://www.elastic.co/downloads/elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.3-darwin-x86_64.tar.gz
# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.3-linux-x86_64.tar.gz
# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.3-windows-x86_64.zip

tar zxf elasticsearch-7.9.3-darwin-x86_64.tar.gz
cd elasticsearch-7.9.3

./bin/elasticsearch

You need to change the elasticsearch.yml configuration to support CORS like this

http.cors.enabled: true
http.cors.allow-origin: /https?:\/\/localhost(:[0-9]+)?/

Kibana might be helpful for some debugging

# https://www.elastic.co/downloads/kibana
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.9.3-darwin-x86_64.tar.gz
# wget https://artifacts.elastic.co/downloads/kibana/kibana-7.9.3-linux-x86_64.tar.gz
# wget https://artifacts.elastic.co/downloads/kibana/kibana-7.9.3-windows-x86_64.zip

tar zxf kibana-7.9.3-darwin-x86_64.tar.gz
cd kibana-7.9.3
./bin/kibana

Sample images

You should go the admin part of the application first, in order to create the data

Then you can check your profile

The list of contacts is shown as well

And the heart of this is the search capability allowing you to specify different queries

About

Svelte based SPA example of using Elasticsearch for a social network search

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published