Created
August 23, 2016 16:54
-
-
Save AndreiD/651b1e8b30e1e98c2d7cbb2979575811 to your computer and use it in GitHub Desktop.
firebase_to_elastic_search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. install java | |
2. sudo apt-get install npm | |
3. Download latest ES https://www.elastic.co/downloads/elasticsearch | |
wget <PASTE_LINK> | |
4. sudo dpkg -i elasticsearch-<version>.deb | |
5. (optional) sudo update-rc.d elasticsearch defaults | |
Configure it | |
The Elasticsearch configuration files are in the /etc/elasticsearch | |
Example: | |
cluster.name: firebasesyncapp | |
node.name: node_fb_1 | |
path.data: /home/elasticsearch | |
path.logs: /home/elasticsearch/logs | |
network.host: 0.0.0.0 (worry about security later ;) | |
http.port: 9200 | |
6. $service elasticsearch start | |
7. Test if everythins is ok: | |
$service elasticsearch status (should show running) | |
from your browser http://serverip:9200 should show a json file with configurations. | |
8. Install Flashlight | |
$mkdir /tmp/flashlight | |
$cd /tmp/flashlight | |
git clone https://github.com/firebase/flashlight | |
$cd flashlight (where the package.json file is) | |
npm install | |
generate a new Firebase service account and configuring FB_SERVICEACCOUNT, https://firebase.google.com/docs/database/server/start | |
create a new file on the server names service_account.json and paste the content of the downloaded file | |
9. edit the config file: change the firebase url (FB_URL) to your database. and on the FB_ACCOUNT write "service_account.json" | |
10. $nodejs app.js | |
11. You have some data into your database right? Let's test the query | |
http://server_ip:9200/firebase/_search | |
in your browser: | |
http://server_ip:9200/_search?source={ "from" : 0, "size" : 100 , "query": { "match_all": {}} } | |
That's all | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment