Skip to main content
The official firestore-meilisearch extension automatically synchronizes documents from a Cloud Firestore collection to a Meilisearch index, enabling full-text search on your Firestore data.
Meilisearch Cloud is the easiest way to get a Meilisearch instance for use with Firebase.

Prerequisites

  • A Firebase project on the Blaze (pay-as-you-go) plan
  • Cloud Firestore set up in your Firebase project
  • A running Meilisearch instance (Cloud or self-hosted)
  • A Meilisearch API key with write permissions

Install the extension

You can install the extension using the Firebase Console or the Firebase CLI.
Visit the Firebase Extensions Hub and click Install.Follow the prompts to select your Firebase project and configure the extension.

Configuration

During installation, you’ll configure the following parameters:
ParameterDescription
Cloud Functions locationRegion where the extension’s functions will be deployed
Collection pathThe Firestore collection to sync (e.g., products, articles)
Fields to indexComma-separated list of field names, or leave blank to index all fields
Meilisearch index nameThe name of the Meilisearch index to sync data to
Meilisearch hostYour Meilisearch instance URL (must start with http:// or https://)
Meilisearch API keyAn API key with permission to manage indexes

How it works

Once installed, the extension deploys a Cloud Function called indexingWorker that:
  1. Listens for document creates, updates, and deletions in your specified collection
  2. Syncs changes to your Meilisearch index in real-time
  3. Maps Firestore document IDs to a _firestore_id field in Meilisearch
The extension only monitors the specified collection, not subcollections. Install additional instances to sync other collections.

Data format

Document IDs

Firestore document IDs are automatically mapped to a _firestore_id field in Meilisearch. Any field named _firestore_id in your source documents will be ignored.

Geolocation

For geo search functionality, name your GeoPoint field _geo in Firestore. Meilisearch will automatically recognize it for geo search queries.
// Firestore document with geo data
{
  name: "Eiffel Tower",
  _geo: new firebase.firestore.GeoPoint(48.8584, 2.2945)
}

Import existing documents

The extension only syncs documents created or modified after installation. To import existing documents, use the provided import script:
npx @meilisearch/firestore-meilisearch-scripts import
See the import script documentation for detailed instructions.

Search your data

Once your data is synced, you can search it using any Meilisearch SDK or the REST API:
import { MeiliSearch } from 'meilisearch'

const client = new MeiliSearch({
  host: process.env.MEILISEARCH_URL,
  apiKey: process.env.MEILISEARCH_API_KEY
})

const results = await client.index('products').search('phone')
console.log(results.hits)

Resources