Learn a CTO’s perspective on Algolia vs. Elasticsearch.

Read More
  • Pricing
  • Partners
  • Log in
  • Start free
Log inStart free
Algolia logo blueprint

Looking for our logo?

We got you covered!

Download logo packMore algolia assets
Share on facebookShare on linkedinShare on twitterShare by email

We know why you are here. You want to learn how to integrate Google Firebase Firestore database with Algolia search. 

Firebase Firestore is a NoSQL cloud database that provides structure to manage your data into multiple collections. It is scalable, serverless and it provides synchronization between client and server and offline mode. Most importantly, it is highly secure and it comes at a reasonable cost.

However, Firebase does not support search functionality out of the box. To solve this, you needed to turn to a third party application — and the one recommended by Firebase is in fact Algolia

We have a search product that enables full-text search that is fast, relevant, API-first, and has a solid free plan that makes it easy to start and grow your product. We also provide a wide choice of client libraries and SDKs for all major languages/platforms and are very proud of our documentation. 

Up until today, however, integrating Algolia and Firebase involved a non-trivial number of steps. Today, we are excited to announce the Firestore<>Algolia extension.  

The technical stack 

Let me provide a high level integration diagram on what we are trying to achieve with these two products in your stack.

So how do we implement the above architecture with the new Firebase Extension Framework? 

The old-school way

There are many articles and blog posts that describe the implementation. The gist of it was to use Cloud Function to implement the logic to monitor the Firestore database and push changes to Algolia indexes. This required writing code in Google Cloud Functions to wire and monitor changes to the Firestore database, as well as maintaining and supporting the integration.

The new kid on the block

At Fireconf 2019, Firebase announced the Firebase Extensions Framework. The idea is to provide users with configuration-only extensions maintained and supported by extension providers. We are proud to have become a part of this framework in 2021, as announced at Google I/O. The Algolia extension can be installed with a click of a button or using a CLI, which will kick off a process to provision the Cloud Function to monitor the Firestore database for changes based on the configuration information provided by the developer. Let’s see this in action.

Prerequisites

1. Navigate to the Firebase Extension listing page.

For details on the extension, click on “See Details”.

 

2. Click “Install in console” to start the installation process. The first step in the process is to create or select an existing Firebase project.

3. You will be prompted to enter the following configurations:

  1. Collection Path, the path to the collection in your Firestore database
  2. Fields, the document fields to be send to Algolia for indexing
  3. Algolia Applications ID
  4. Algolia Index Name
  5. Algolia Api Key
  6. Location, GCP region to deploy the Cloud Function

NOTE: This extension can be installed multiple times monitoring different collections and pushing the changes to a central Algolia Search Index or a separate Index for each collection.

That’s it!  Now go ahead and click install and configure to your heart’s desire, and don’t forget to send us feedback: twitter.com/algolia. Happy configuring!

P.S. Future improvements

There are known limitations on the extension, which will be addressed in future releases.  

  1. Algolia relevance works well with records smaller than 10kb or the limit set based on your plan.  Any record larger than this limit will be rejected by Algolia Indexing Process.  In future versions of the extension, we are hoping to implement a record splitting logic to break large records into smaller records for indexing.  Refer to Sending and Managing data for more information on large documents.
  2. Restructuring the Firestore document before sending to Algolia to improve relevance.
Share on facebookShare on linkedinShare on twitterShare by email
About the author

Loading amazing content…

Subscribe to the blog updates
Thank you for subscribing, stay tuned!