POST /1/indexes/{indexName}/rules/batch
Create or update multiple rules.
If a rule with the specified object ID doesn't exist, Algolia creates a new one. Otherwise, existing rules are replaced.
This operation is subject to indexing rate limits.
Servers
- https://{appId}.algolia.net
- https://{appId}-1.algolianet.com
- https://{appId}-2.algolianet.com
- https://{appId}-3.algolianet.com
- https://{appId}-dsn.algolia.net
Path parameters
Name | Type | Required | Description |
---|---|---|---|
indexName |
String | Yes |
Name of the index on which to perform the operation. |
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Query parameters
Name | Type | Required | Description |
---|---|---|---|
clearExistingRules |
Boolean | No |
Whether existing rules should be deleted before adding this batch. |
forwardToReplicas |
Boolean | No |
Whether changes are applied to replica indices. |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
[] |
Array | Yes | |
[].description |
String | No |
Description of the rule's purpose to help you distinguish between different rules. |
[].conditions[] |
Array | No |
Conditions that trigger a rule. Some consequences require specific conditions or don't require any condition. For more information, see Conditions. |
[].conditions[].filters |
String | No |
Filters that trigger the rule. You can add add filters using the syntax |
[].conditions[].anchoring |
String | No |
Which part of the search query the pattern should match:
Empty queries are only allowed as patterns with Possible values:
|
[].conditions[].context |
String | No |
An additional restriction that only triggers the rule, when the search has the same value as |
[].conditions[].alternatives |
Boolean | No |
Whether the pattern should match plurals, synonyms, and typos. Default value: false |
[].conditions[].pattern |
String | No |
Query pattern that triggers the rule. You can use either a literal string, or a special pattern |
[].consequence |
Object | Yes |
Effect of the rule. For more information, see Consequences. |
[].consequence.promote[] |
Array | No |
Records you want to pin to a specific position in the search results. You can promote up to 300 records, either individually, or as groups of up to 100 records each. |
[].consequence.filterPromotes |
Boolean | No |
Whether promoted records must match an active filter for the consequence to be applied. This ensures that user actions (filtering the search) are given a higher precendence.
For example, if you promote a record with the Default value: false |
[].consequence.hide[] |
Array | No |
Records you want to hide from the search results. |
[].consequence.hide[].objectID |
String | Yes |
Unique record identifier. |
[].consequence.userData |
Object | No |
A JSON object with custom data that will be appended to the |
[].enabled |
Boolean | No |
Whether the rule is active. Default value: true |
[].objectID |
String | Yes |
Unique identifier of a rule object. |
[].validity[] |
Array | No |
Time periods when the rule is active. |
[].validity[].until |
Integer | Yes |
When the rule should stop to be active, in Unix epoch time. |
[].validity[].from |
Integer | Yes |
When the rule should start to be active, in Unix epoch time. |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.