POST /1/indexes/{indexName}/{model}/recommend/rules/batch
Create or update a batch of Recommend Rules
Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same objectID
already exists.
You may also specify true
for clearExistingRules
, in which case the batch will atomically replace all the existing Recommend Rules.
Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a source item instead of a query. The main differences are the following:
- Conditions
pattern
andanchoring
are unavailable. - Condition
filters
triggers if the source item matches the specified filters. - Condition
filters
accepts numeric filters. - Consequence
params
only covers filtering parameters. - Consequence
automaticFacetFilters
doesn't require a facet value placeholder (it tries to match the data source item's attributes instead).
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. |
model |
String | Yes |
Recommend model. Possible values:
|
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
[] |
Array | Yes | |
[]._metadata |
Object | No |
Rule metadata. |
[]._metadata.lastUpdate |
String | No |
Date and time when the object was updated, in RFC 3339 format. |
[].description |
String | No |
Description of the rule's purpose. This can be helpful for display in the Algolia dashboard. |
[].condition |
Object | No |
Condition that triggers the rule. If not specified, the rule is triggered for all recommendations. |
[].condition.filters |
String | No |
Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions:
You can combine filters with
Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords ( For more information, see Filters. |
[].condition.context |
String | No |
An additional restriction that only triggers the rule, when the search has the same value as |
[].consequence |
Object | No |
Effect of the rule. |
[].consequence.params |
Object | No |
Filter or boost recommendations matching a facet filter. |
[].consequence.params.filters |
String | No |
Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions:
You can combine filters with
Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords ( For more information, see Filters. |
[].consequence.params.optionalFilters[] |
Array | No |
Filters to promote or demote records in the search results. Optional filters work like facet filters, but they don't exclude records from the search results.
Records that match the optional filter rank before records that don't match.
Matches with higher weights ( |
[].consequence.params.automaticFacetFilters[] |
Array | No |
Filter recommendations that match or don't match the same |
[].consequence.params.automaticFacetFilters[].facet |
String | No |
Facet attribute. |
[].consequence.params.automaticFacetFilters[].negative |
Boolean | No |
Whether the filter is negative.
If true, recommendations must not have the same value for the |
[].consequence.promote[] |
Array | No |
Place items at specific positions in the list of recommendations. |
[].consequence.promote[].objectID |
String | No |
Unique record identifier. |
[].consequence.promote[].position |
Integer | No |
Index in the list of recommendations where to place this item. |
[].consequence.hide[] |
Array | No |
Exclude items from recommendations. |
[].consequence.hide[].objectID |
String | No |
Unique record identifier. |
[].enabled |
Boolean | No |
Indicates whether to enable the rule. If it isn't enabled, it isn't applied at query time. Default value: true |
[].objectID |
String | No |
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.