Announcing the Firebase + Algolia search extension
Tags: firebase, algolia, android, search
Published: 2021-05-20 13:46:32

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](https://www.algolia.com). 

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](https://effbada.hashnode.dev/how-to-import-data-from-firebase-firestore-into-algolia-using-cloud-functions-part-2-ckcrwverh000flvs10l5rfloy). 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](https://effbada.hashnode.dev/how-to-update-algolia-data-to-match-changes-in-firebase-firestore-with-cloud-functions-part-3-ckcrx6yv4000kkys199x6gi9v) 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
[Google Cloud Platform account](https://cloud.google.com/)
[Firebase project](https://console.firebase.google.com/)
[Algolia account](https://www.algolia.com/users/sign_up)

Navigate to the [Firebase Extension listing page](https://firebase.google.com/products/extensions/).

![Firebase Extension listing page](https://blog-api.algolia.com/wp-content/uploads/2021/05/image1-1-768x699.png)



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

![See Details](https://blog-api.algolia.com/wp-content/uploads/2021/05/image2-1.png)

 

Click “Install in console” to start the installation process. The first step in the process is to create or select an existing Firebase project.
![Install in console](https://blog-api.algolia.com/wp-content/uploads/2021/05/image4.png)


You will be prompted to enter the following configurations:
![Configurations](https://blog-api.algolia.com/wp-content/uploads/2021/05/image3-1-768x1054.png)


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](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/tutorials/google-drive-algolia/#large-documents).

2. ![Restructuring the Firestore document before sending to Algolia](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/in-depth/prepare-data-in-depth/) to improve relevance.