Skip to content

Instantly share code, notes, and snippets.

@kopertop
Last active September 15, 2022 11:15
Show Gist options
  • Save kopertop/4572aff15dae7e1bb6d22355f8ed6c52 to your computer and use it in GitHub Desktop.
Save kopertop/4572aff15dae7e1bb6d22355f8ed6c52 to your computer and use it in GitHub Desktop.
Export all Algolia Index settings
#!/bin/bash
for index in $( algolia indices list --output jsonpath --template="{..name}" ); do
echo "Export ${index}"
algolia settings get ${index} > ${index}.json
# If you have jq installed, you can get pretty formatted JSON output using:
# algolia settings get ${index} | jq "." > ${index}.json
done
# Add the following to automatically commit and push to a repository
# git add *.json
# git commit -a --m "Automatic Settings Export"
# git push
@kopertop
Copy link
Author

This is already in production at my company!

@clemfromspace
Copy link

clemfromspace commented Sep 14, 2022

Love it ❤️ !

An alternative to | jq "." to get the pretty format would be | python -m json.tool I discovered not long ago.

Also, since you are talking about saving your settings to a repository, we released a GitHub Actions the could come handy :)

@clemfromspace
Copy link

Also congratulations on the hammock!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment