Giter Club home page Giter Club logo

flashlight's Introduction

Flashlight

A pluggable integration with ElasticSearch to provide advanced content searches in Firebase.

This script can:

  • monitor multiple Firebase paths and index data in real time
  • communicates with client completely via Firebase (client pushes search terms to search/request and reads results from search/result)
  • clean up old, outdated requests

Getting Started

  • Install and run ElasticSearch or add Bonsai service via Heroku
  • git clone https://github.com/firebase/flashlight
  • npm install
  • edit config.js (see comments at the top, you must set FB_URL at a minimum)
  • node app.js (run the app)

Check out the recommended security rules in example/seed/security_rules.json. See example/README.md to seed and run an example client app.

If you experience errors like {"error":"IndexMissingException[[firebase] missing]","status":404}, you may need to manually create the index referenced in each path:

curl -X POST http://localhost:9200/firebase

Client Implementations

Read example/index.html and example/example.js for a client implementation. It works like this:

  • Push an object to /search/request which has the following keys: index, type, and query
  • Listen on /search/response for the reply from the server

The query object can be any valid ElasticSearch DSL structure (see More on Queries).

More on Queries

The full ElasticSearch API is supported. For example, you can control the number of matches (defaults to 10) and initial offset for paginating search results:

queryObj : { "from" : 0, "size" : 50 , "query": queryObj }; 

Check out this great tutorial on querying ElasticSearch. And be sure to read the ElasticSearch API Reference.

Deploy to Heroku

  • cd flashlight
  • heroku login
  • heroku create (add heroku to project)
  • heroku addons:add bonsai (install bonsai)
  • heroku config (check bonsai instance info and copy your new BONSAI_URL - you will need it later)
  • heroku config:set FB_NAME=<instance> FB_TOKEN="<token>" (declare environment variables)
  • git add config.js (update)
  • git commit -m "configure bonsai"
  • git push heroku master (deploy to heroku)
  • heroku ps:scale worker=1 (start dyno worker)

Setup Initial Index with Bonsai

After you've deployed to Heroku, you need to create your initial index name to prevent IndexMissingException error from Bonsai. Create an index called "firebase" via curl using the BONSAI_URL that you copied during Heroku deployment.

Support

Submit questions or bugs using the issue tracker.

For Firebase-releated questions, try the mailing list.

License

MIT LICENSE Copyright © 2013 Firebase [email protected]

flashlight's People

Contributors

katowulf avatar robotnoises avatar idanb11 avatar agius avatar evert0n avatar jamesmanning avatar nadeesha avatar grenade avatar jsgeekiee avatar nessup avatar

Watchers

James Cloos avatar sivaram si avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.