https://github.com/typesense/algolia-query-rules-to-typesense
A CLI utility to import Algolia's query rules JSON into Typesense
https://github.com/typesense/algolia-query-rules-to-typesense
Last synced: 5 months ago
JSON representation
A CLI utility to import Algolia's query rules JSON into Typesense
- Host: GitHub
- URL: https://github.com/typesense/algolia-query-rules-to-typesense
- Owner: typesense
- Created: 2024-01-10T00:47:16.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-09T18:59:58.000Z (almost 2 years ago)
- Last Synced: 2025-09-07T22:39:37.810Z (10 months ago)
- Language: JavaScript
- Size: 151 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ```algolia-query-rules-to-typesense```
This is a simple CLI utility to convert query rules from Algolia to Typesense's Override API JSON.
## Usage:
```bash
npx algolia-query-rules-to-typesense
```
To get `algolia_rules_export.json`, go to the "Rules" section of your Algolia index, and you'll find a download icon to export the rules as JSON.
This is the expected format of `algolia_rules_export.json`:
```json
[
{
"description": "Test Rule",
"conditions": [
{
"anchoring": "is",
"pattern": "keyword",
"alternatives": true
}
],
"consequence": {
"params": {
"filters": "..."
},
"filterPromotes": true
},
"enabled": true,
"objectID": "qr-1682441011"
}
]
```
After running this command, the output JSON will be in this format:
```json
[
{
"id": "Test Rule - qr-1682441011",
"rule": {
"query": "keyword",
"match": "exact"
},
"filter_curated_hits": true,
"filter_by": "..."
}
]
```
You can then import these JSON rules into Typesense using the [Typesense API](https://typesense.org/docs/0.25.2/api/curation.html#create-or-update-an-override).