9

I'm installing the Algolia extension for Firestore. Setup works just fine and it updates indices on add delete and update. But now I want to backfill it with existing data.

The following steps are provided in the setup guide but I have no clue on HOW to run that script. I've tried pasting it directly in node shell and powershell, adding it to a js or ps1 file and running that but I don't know what kind of script this is.

Firestore console

How do I run this script? (I have a service account json next to it)

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Jonathan
  • 8,771
  • 4
  • 41
  • 78
  • did you actually make this work? For me when running the script, the command is not completing. Also have [this](https://stackoverflow.com/questions/75423907/correctly-import-data-from-firestore-to-algolia) question up. Did it work for you ? – Chris Feb 11 '23 at 23:27

1 Answers1

6

It's bash...

It works when pasted directly in bash with spaces on each newline after the line terminator. Or as a .sh file from the commandline.

#!/bin/bash
LOCATION=europe-west3\
  ALGOLIA_APP_ID=xxx\
  ALGOLIA_API_KEY=xxx\
  ALGOLIA_INDEX_NAME=organizations\
  COLLECTION_PATH=organizations\
  FIELDS=name,address,city\
  GOOGLE_APPLICATION_CREDENTIALS=./xxx.json\
  npx firestore-algolia-search
Jonathan
  • 8,771
  • 4
  • 41
  • 78
  • 4
    *firebaser here* Thanks for flagging and clarifying the documentation Jonathan. This could/should indeed have been made clearer in those instructions. I've flagged it with the team. – Frank van Puffelen Jun 10 '21 at 14:28
  • Frank this still has not been made clear. I have to this day still not have been successfull at running this script. – David Jentjens Jun 19 '22 at 03:11