algolia rules
Manage your Algolia rules.
algolia rules browse
algolia rules browse <index> [flags]
List all the rules of an index.
Examples
1
2
3
4
5
6
# List all the rules of the "TEST_PRODUCTS_1" index
$ algolia rules browse TEST_PRODUCTS_1
# List all the rules of the "TEST_PRODUCTS_1" index and save them to a 'rules.ndjson' file
$ algolia rules browse TEST_PRODUCTS_1 --json > rules.ndjson
Output formatting flags
-
--allow-missing-template-keys
-
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
-
-o
,--output
-
Output format. One of: (json, jsonpath, jsonpath-as-json, jsonpath-file).
-
--template
-
Template string or path to template file to use when –output=jsonpath, –output=jsonpath-file.
algolia rules delete
algolia rules delete <index> --rule-ids <rule-ids> --confirm [flags]
Delete rules from an index.
Examples
1
2
3
4
5
6
# Delete one single rule with the ID "1" from the "TEST_PRODUCTS_1" index
$ algolia rules delete TEST_PRODUCTS_1 --rule-ids 1
# Delete multiple rules with the IDs "1" and "2" from the "TEST_PRODUCTS_1" index
$ algolia rules delete TEST_PRODUCTS_1 --rule-ids 1,2
Flags
-
-y
,--confirm
-
skip confirmation prompt.
-
--forward-to-replicas
-
Forward the delete request to the replicas.
-
--rule-ids
-
Rule IDs to delete.
algolia rules import
algolia rules import <index> -F <file> [flags]
Import rules to the specified index.
Examples
1
2
3
4
5
6
7
8
9
10
11
12
# Import rules from the "rules.ndjson" file to the "TEST_PRODUCTS_1" index
$ algolia rules import TEST_PRODUCTS_1 -F rules.ndjson
# Import rules from the standard input to the "TEST_PRODUCTS_1" index
$ cat rules.ndjson | algolia rules import TEST_PRODUCTS_1 -F -
# Browse the rules in the "TEST_PRODUCTS_1" index and import them to the "TEST_PRODUCTS_2" index
$ algolia rules browse TEST_PRODUCTS_2 | algolia rules import TEST_PRODUCTS_2 -F -
# Import rules from the "rules.ndjson" file to the "TEST_PRODUCTS_1" index and don't forward them to the index replicas
$ algolia import TEST_PRODUCTS_1 -F rules.ndjson -f=false
Flags
-
-c
,--clear-existing-rules
-
Clear existing rules before importing new ones.
-
-y
,--confirm
-
skip confirmation prompt.
-
-F
,--file
-
Read rules to import from
file
(use “-“ to read from standard input). -
-f
,--forward-to-replicas
-
Forward the rules to the index replicas.