Suggestive Search w/ Firebase Cloud Functions, ElasticSearch + Angular

  • “Kitchen Sink” approach can be overwhelming, requiring features and dependencies you might not need (but still add to your size budget…)
  • Not 100% Polymorphic (yet) - Still has some issues w/ SSR
  • Can become costly depending on your data circumstances

Requirements

  • Google Cloud Account
  • Firebase Project (Blaze Plan)
  • Latest Angular (8, presently)

Deploy ElasticSearch

Launch ElasticSearch on Google Cloud
ElasticSearch Server Credentials

Setup Cloud Functions

> firebase functions:config:set elasticsearch.username="user" elasticsearch.password="PASSWORD" elasticsearch.url="http://IP_ADDRESS/elasticsearch"
> npm install request request-promise --save
/functions/src/index.ts
> firebase deploy --only functions

Seed Data » FakerJS

/functions/seed.ts
/tmp/serviceAccountKey.json
> node functions/seed.ts

Confirm + Preview » Dejavu Extension

Dejavu Chrome Extension

Angular Service + Component

/services/search.service.ts
/components/search/search.component.ts
/components/search/search.component.html
Voila!

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store