1. Packages
  2. Algolia Provider
  3. API Docs
  4. Rule
algolia 0.6.0 published on Monday, Apr 14, 2025 by k-yomo

algolia.Rule

Explore with Pulumi AI

algolia logo
algolia 0.6.0 published on Monday, Apr 14, 2025 by k-yomo

    A configuration for a Rule. To get more information about rules, see the Official Documentation.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as algolia from "@pulumi/algolia";
    
    const example = new algolia.Rule("example", {
        conditions: [{
            anchoring: "contains",
            pattern: "{facet:category}",
        }],
        consequence: {
            params: {
                automaticFacetFilters: [{
                    disjunctive: true,
                    facet: "category",
                }],
            },
        },
        indexName: "example_index",
        objectId: "example",
    });
    
    import pulumi
    import pulumi_algolia as algolia
    
    example = algolia.Rule("example",
        conditions=[{
            "anchoring": "contains",
            "pattern": "{facet:category}",
        }],
        consequence={
            "params": {
                "automatic_facet_filters": [{
                    "disjunctive": True,
                    "facet": "category",
                }],
            },
        },
        index_name="example_index",
        object_id="example")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/algolia/algolia"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := algolia.NewRule(ctx, "example", &algolia.RuleArgs{
    			Conditions: algolia.RuleConditionArray{
    				&algolia.RuleConditionArgs{
    					Anchoring: pulumi.String("contains"),
    					Pattern:   pulumi.String("{facet:category}"),
    				},
    			},
    			Consequence: &algolia.RuleConsequenceArgs{
    				Params: &algolia.RuleConsequenceParamsArgs{
    					AutomaticFacetFilters: algolia.RuleConsequenceParamsAutomaticFacetFilterArray{
    						&algolia.RuleConsequenceParamsAutomaticFacetFilterArgs{
    							Disjunctive: pulumi.Bool(true),
    							Facet:       pulumi.String("category"),
    						},
    					},
    				},
    			},
    			IndexName: pulumi.String("example_index"),
    			ObjectId:  pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Algolia = Pulumi.Algolia;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Algolia.Rule("example", new()
        {
            Conditions = new[]
            {
                new Algolia.Inputs.RuleConditionArgs
                {
                    Anchoring = "contains",
                    Pattern = "{facet:category}",
                },
            },
            Consequence = new Algolia.Inputs.RuleConsequenceArgs
            {
                Params = new Algolia.Inputs.RuleConsequenceParamsArgs
                {
                    AutomaticFacetFilters = new[]
                    {
                        new Algolia.Inputs.RuleConsequenceParamsAutomaticFacetFilterArgs
                        {
                            Disjunctive = true,
                            Facet = "category",
                        },
                    },
                },
            },
            IndexName = "example_index",
            ObjectId = "example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.algolia.Rule;
    import com.pulumi.algolia.RuleArgs;
    import com.pulumi.algolia.inputs.RuleConditionArgs;
    import com.pulumi.algolia.inputs.RuleConsequenceArgs;
    import com.pulumi.algolia.inputs.RuleConsequenceParamsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new Rule("example", RuleArgs.builder()
                .conditions(RuleConditionArgs.builder()
                    .anchoring("contains")
                    .pattern("{facet:category}")
                    .build())
                .consequence(RuleConsequenceArgs.builder()
                    .params(RuleConsequenceParamsArgs.builder()
                        .automaticFacetFilters(RuleConsequenceParamsAutomaticFacetFilterArgs.builder()
                            .disjunctive(true)
                            .facet("category")
                            .build())
                        .build())
                    .build())
                .indexName("example_index")
                .objectId("example")
                .build());
    
        }
    }
    
    resources:
      example:
        type: algolia:Rule
        properties:
          conditions:
            - anchoring: contains
              pattern: '{facet:category}'
          consequence:
            params:
              automaticFacetFilters:
                - disjunctive: true
                  facet: category
          indexName: example_index
          objectId: example
    

    Create Rule Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Rule(name: string, args: RuleArgs, opts?: CustomResourceOptions);
    @overload
    def Rule(resource_name: str,
             args: RuleArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Rule(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             consequence: Optional[RuleConsequenceArgs] = None,
             index_name: Optional[str] = None,
             object_id: Optional[str] = None,
             conditions: Optional[Sequence[RuleConditionArgs]] = None,
             description: Optional[str] = None,
             enabled: Optional[bool] = None,
             rule_id: Optional[str] = None,
             validities: Optional[Sequence[RuleValidityArgs]] = None)
    func NewRule(ctx *Context, name string, args RuleArgs, opts ...ResourceOption) (*Rule, error)
    public Rule(string name, RuleArgs args, CustomResourceOptions? opts = null)
    public Rule(String name, RuleArgs args)
    public Rule(String name, RuleArgs args, CustomResourceOptions options)
    
    type: algolia:Rule
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args RuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args RuleArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args RuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var ruleResource = new Algolia.Rule("ruleResource", new()
    {
        Consequence = new Algolia.Inputs.RuleConsequenceArgs
        {
            Hides = new[]
            {
                "string",
            },
            ParamsJson = "string",
            Promotes = new[]
            {
                new Algolia.Inputs.RuleConsequencePromoteArgs
                {
                    ObjectIds = new[]
                    {
                        "string",
                    },
                    Position = 0,
                },
            },
            UserData = "string",
        },
        IndexName = "string",
        ObjectId = "string",
        Conditions = new[]
        {
            new Algolia.Inputs.RuleConditionArgs
            {
                Alternatives = false,
                Anchoring = "string",
                Context = "string",
                Pattern = "string",
            },
        },
        Description = "string",
        Enabled = false,
        RuleId = "string",
        Validities = new[]
        {
            new Algolia.Inputs.RuleValidityArgs
            {
                From = "string",
                Until = "string",
            },
        },
    });
    
    example, err := algolia.NewRule(ctx, "ruleResource", &algolia.RuleArgs{
    	Consequence: &algolia.RuleConsequenceArgs{
    		Hides: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		ParamsJson: pulumi.String("string"),
    		Promotes: algolia.RuleConsequencePromoteArray{
    			&algolia.RuleConsequencePromoteArgs{
    				ObjectIds: pulumi.StringArray{
    					pulumi.String("string"),
    				},
    				Position: pulumi.Float64(0),
    			},
    		},
    		UserData: pulumi.String("string"),
    	},
    	IndexName: pulumi.String("string"),
    	ObjectId:  pulumi.String("string"),
    	Conditions: algolia.RuleConditionArray{
    		&algolia.RuleConditionArgs{
    			Alternatives: pulumi.Bool(false),
    			Anchoring:    pulumi.String("string"),
    			Context:      pulumi.String("string"),
    			Pattern:      pulumi.String("string"),
    		},
    	},
    	Description: pulumi.String("string"),
    	Enabled:     pulumi.Bool(false),
    	RuleId:      pulumi.String("string"),
    	Validities: algolia.RuleValidityArray{
    		&algolia.RuleValidityArgs{
    			From:  pulumi.String("string"),
    			Until: pulumi.String("string"),
    		},
    	},
    })
    
    var ruleResource = new Rule("ruleResource", RuleArgs.builder()
        .consequence(RuleConsequenceArgs.builder()
            .hides("string")
            .paramsJson("string")
            .promotes(RuleConsequencePromoteArgs.builder()
                .objectIds("string")
                .position(0)
                .build())
            .userData("string")
            .build())
        .indexName("string")
        .objectId("string")
        .conditions(RuleConditionArgs.builder()
            .alternatives(false)
            .anchoring("string")
            .context("string")
            .pattern("string")
            .build())
        .description("string")
        .enabled(false)
        .ruleId("string")
        .validities(RuleValidityArgs.builder()
            .from("string")
            .until("string")
            .build())
        .build());
    
    rule_resource = algolia.Rule("ruleResource",
        consequence={
            "hides": ["string"],
            "params_json": "string",
            "promotes": [{
                "object_ids": ["string"],
                "position": 0,
            }],
            "user_data": "string",
        },
        index_name="string",
        object_id="string",
        conditions=[{
            "alternatives": False,
            "anchoring": "string",
            "context": "string",
            "pattern": "string",
        }],
        description="string",
        enabled=False,
        rule_id="string",
        validities=[{
            "from_": "string",
            "until": "string",
        }])
    
    const ruleResource = new algolia.Rule("ruleResource", {
        consequence: {
            hides: ["string"],
            paramsJson: "string",
            promotes: [{
                objectIds: ["string"],
                position: 0,
            }],
            userData: "string",
        },
        indexName: "string",
        objectId: "string",
        conditions: [{
            alternatives: false,
            anchoring: "string",
            context: "string",
            pattern: "string",
        }],
        description: "string",
        enabled: false,
        ruleId: "string",
        validities: [{
            from: "string",
            until: "string",
        }],
    });
    
    type: algolia:Rule
    properties:
        conditions:
            - alternatives: false
              anchoring: string
              context: string
              pattern: string
        consequence:
            hides:
                - string
            paramsJson: string
            promotes:
                - objectIds:
                    - string
                  position: 0
            userData: string
        description: string
        enabled: false
        indexName: string
        objectId: string
        ruleId: string
        validities:
            - from: string
              until: string
    

    Rule Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Rule resource accepts the following input properties:

    Consequence RuleConsequence
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    IndexName string
    Name of the index to apply rule.
    ObjectId string
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    Conditions List<RuleCondition>
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    Description string
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    Enabled bool
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    RuleId string
    Validities List<RuleValidity>
    Objects to promote as hits.
    Consequence RuleConsequenceArgs
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    IndexName string
    Name of the index to apply rule.
    ObjectId string
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    Conditions []RuleConditionArgs
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    Description string
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    Enabled bool
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    RuleId string
    Validities []RuleValidityArgs
    Objects to promote as hits.
    consequence RuleConsequence
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    indexName String
    Name of the index to apply rule.
    objectId String
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    conditions List<RuleCondition>
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    description String
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    enabled Boolean
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    ruleId String
    validities List<RuleValidity>
    Objects to promote as hits.
    consequence RuleConsequence
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    indexName string
    Name of the index to apply rule.
    objectId string
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    conditions RuleCondition[]
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    description string
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    enabled boolean
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    ruleId string
    validities RuleValidity[]
    Objects to promote as hits.
    consequence RuleConsequenceArgs
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    index_name str
    Name of the index to apply rule.
    object_id str
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    conditions Sequence[RuleConditionArgs]
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    description str
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    enabled bool
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    rule_id str
    validities Sequence[RuleValidityArgs]
    Objects to promote as hits.
    consequence Property Map
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    indexName String
    Name of the index to apply rule.
    objectId String
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    conditions List<Property Map>
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    description String
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    enabled Boolean
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    ruleId String
    validities List<Property Map>
    Objects to promote as hits.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Rule resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Rule Resource

    Get an existing Rule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: RuleState, opts?: CustomResourceOptions): Rule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            conditions: Optional[Sequence[RuleConditionArgs]] = None,
            consequence: Optional[RuleConsequenceArgs] = None,
            description: Optional[str] = None,
            enabled: Optional[bool] = None,
            index_name: Optional[str] = None,
            object_id: Optional[str] = None,
            rule_id: Optional[str] = None,
            validities: Optional[Sequence[RuleValidityArgs]] = None) -> Rule
    func GetRule(ctx *Context, name string, id IDInput, state *RuleState, opts ...ResourceOption) (*Rule, error)
    public static Rule Get(string name, Input<string> id, RuleState? state, CustomResourceOptions? opts = null)
    public static Rule get(String name, Output<String> id, RuleState state, CustomResourceOptions options)
    resources:  _:    type: algolia:Rule    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Conditions List<RuleCondition>
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    Consequence RuleConsequence
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    Description string
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    Enabled bool
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    IndexName string
    Name of the index to apply rule.
    ObjectId string
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    RuleId string
    Validities List<RuleValidity>
    Objects to promote as hits.
    Conditions []RuleConditionArgs
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    Consequence RuleConsequenceArgs
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    Description string
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    Enabled bool
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    IndexName string
    Name of the index to apply rule.
    ObjectId string
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    RuleId string
    Validities []RuleValidityArgs
    Objects to promote as hits.
    conditions List<RuleCondition>
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    consequence RuleConsequence
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    description String
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    enabled Boolean
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    indexName String
    Name of the index to apply rule.
    objectId String
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    ruleId String
    validities List<RuleValidity>
    Objects to promote as hits.
    conditions RuleCondition[]
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    consequence RuleConsequence
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    description string
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    enabled boolean
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    indexName string
    Name of the index to apply rule.
    objectId string
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    ruleId string
    validities RuleValidity[]
    Objects to promote as hits.
    conditions Sequence[RuleConditionArgs]
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    consequence RuleConsequenceArgs
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    description str
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    enabled bool
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    index_name str
    Name of the index to apply rule.
    object_id str
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    rule_id str
    validities Sequence[RuleValidityArgs]
    Objects to promote as hits.
    conditions List<Property Map>
    A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule.
    consequence Property Map
    Consequence of the Rule. At least one of the following object must be used: - params - promote - hide - user_data
    description String
    This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It is not interpreted by the API.
    enabled Boolean
    Whether the Rule is enabled. Disabled Rules remain in the index, but are not applied at query time.
    indexName String
    Name of the index to apply rule.
    objectId String
    Unique identifier for the Rule (format: [A-Za-z0-9_-]+).
    ruleId String
    validities List<Property Map>
    Objects to promote as hits.

    Supporting Types

    RuleCondition, RuleConditionArgs

    Alternatives bool

    Whether the pattern matches on plurals, synonyms, and typos.

    This parameter goes hand in hand with the pattern parameter. If the pattern is “shoe” and alternatives is true, the pattern matches on “shoes”, as well as synonyms and typos of “shoe”.

    Anchoring string

    Whether the pattern parameter must match the beginning or the end of the query string, or both, or none. Possible values are is, startsWith, endsWith and contains. This parameter goes hand in hand with the pattern parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring.

    Otherwise, you can omit both.

    Context string
    Rule context (format: [A-Za-z0-9_-]+). When specified, the Rule is only applied when the same context is specified at query time (using the ruleContexts parameter). When absent, the Rule is generic and always applies (provided that its other conditions are met, of course).
    Pattern string

    Query pattern syntax. Query patterns are expressed as a string with a specific syntax. A pattern is a sequence of tokens, which can be either:

    • Facet value placeholder: {facet:$facet_name}. Example: {facet:brand}.
    • Literal: the world itself. Example: Algolia. Special characters (*, {, }, : and \) must be escaped by preceding them with a backslash () if they are to be treated as literals.

    This parameter goes hand in hand with the anchoring parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring. The empty "" pattern is only allowed when anchoring is set to is.

    Otherwise, you can omit both.

    Alternatives bool

    Whether the pattern matches on plurals, synonyms, and typos.

    This parameter goes hand in hand with the pattern parameter. If the pattern is “shoe” and alternatives is true, the pattern matches on “shoes”, as well as synonyms and typos of “shoe”.

    Anchoring string

    Whether the pattern parameter must match the beginning or the end of the query string, or both, or none. Possible values are is, startsWith, endsWith and contains. This parameter goes hand in hand with the pattern parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring.

    Otherwise, you can omit both.

    Context string
    Rule context (format: [A-Za-z0-9_-]+). When specified, the Rule is only applied when the same context is specified at query time (using the ruleContexts parameter). When absent, the Rule is generic and always applies (provided that its other conditions are met, of course).
    Pattern string

    Query pattern syntax. Query patterns are expressed as a string with a specific syntax. A pattern is a sequence of tokens, which can be either:

    • Facet value placeholder: {facet:$facet_name}. Example: {facet:brand}.
    • Literal: the world itself. Example: Algolia. Special characters (*, {, }, : and \) must be escaped by preceding them with a backslash () if they are to be treated as literals.

    This parameter goes hand in hand with the anchoring parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring. The empty "" pattern is only allowed when anchoring is set to is.

    Otherwise, you can omit both.

    alternatives Boolean

    Whether the pattern matches on plurals, synonyms, and typos.

    This parameter goes hand in hand with the pattern parameter. If the pattern is “shoe” and alternatives is true, the pattern matches on “shoes”, as well as synonyms and typos of “shoe”.

    anchoring String

    Whether the pattern parameter must match the beginning or the end of the query string, or both, or none. Possible values are is, startsWith, endsWith and contains. This parameter goes hand in hand with the pattern parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring.

    Otherwise, you can omit both.

    context String
    Rule context (format: [A-Za-z0-9_-]+). When specified, the Rule is only applied when the same context is specified at query time (using the ruleContexts parameter). When absent, the Rule is generic and always applies (provided that its other conditions are met, of course).
    pattern String

    Query pattern syntax. Query patterns are expressed as a string with a specific syntax. A pattern is a sequence of tokens, which can be either:

    • Facet value placeholder: {facet:$facet_name}. Example: {facet:brand}.
    • Literal: the world itself. Example: Algolia. Special characters (*, {, }, : and \) must be escaped by preceding them with a backslash () if they are to be treated as literals.

    This parameter goes hand in hand with the anchoring parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring. The empty "" pattern is only allowed when anchoring is set to is.

    Otherwise, you can omit both.

    alternatives boolean

    Whether the pattern matches on plurals, synonyms, and typos.

    This parameter goes hand in hand with the pattern parameter. If the pattern is “shoe” and alternatives is true, the pattern matches on “shoes”, as well as synonyms and typos of “shoe”.

    anchoring string

    Whether the pattern parameter must match the beginning or the end of the query string, or both, or none. Possible values are is, startsWith, endsWith and contains. This parameter goes hand in hand with the pattern parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring.

    Otherwise, you can omit both.

    context string
    Rule context (format: [A-Za-z0-9_-]+). When specified, the Rule is only applied when the same context is specified at query time (using the ruleContexts parameter). When absent, the Rule is generic and always applies (provided that its other conditions are met, of course).
    pattern string

    Query pattern syntax. Query patterns are expressed as a string with a specific syntax. A pattern is a sequence of tokens, which can be either:

    • Facet value placeholder: {facet:$facet_name}. Example: {facet:brand}.
    • Literal: the world itself. Example: Algolia. Special characters (*, {, }, : and \) must be escaped by preceding them with a backslash () if they are to be treated as literals.

    This parameter goes hand in hand with the anchoring parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring. The empty "" pattern is only allowed when anchoring is set to is.

    Otherwise, you can omit both.

    alternatives bool

    Whether the pattern matches on plurals, synonyms, and typos.

    This parameter goes hand in hand with the pattern parameter. If the pattern is “shoe” and alternatives is true, the pattern matches on “shoes”, as well as synonyms and typos of “shoe”.

    anchoring str

    Whether the pattern parameter must match the beginning or the end of the query string, or both, or none. Possible values are is, startsWith, endsWith and contains. This parameter goes hand in hand with the pattern parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring.

    Otherwise, you can omit both.

    context str
    Rule context (format: [A-Za-z0-9_-]+). When specified, the Rule is only applied when the same context is specified at query time (using the ruleContexts parameter). When absent, the Rule is generic and always applies (provided that its other conditions are met, of course).
    pattern str

    Query pattern syntax. Query patterns are expressed as a string with a specific syntax. A pattern is a sequence of tokens, which can be either:

    • Facet value placeholder: {facet:$facet_name}. Example: {facet:brand}.
    • Literal: the world itself. Example: Algolia. Special characters (*, {, }, : and \) must be escaped by preceding them with a backslash () if they are to be treated as literals.

    This parameter goes hand in hand with the anchoring parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring. The empty "" pattern is only allowed when anchoring is set to is.

    Otherwise, you can omit both.

    alternatives Boolean

    Whether the pattern matches on plurals, synonyms, and typos.

    This parameter goes hand in hand with the pattern parameter. If the pattern is “shoe” and alternatives is true, the pattern matches on “shoes”, as well as synonyms and typos of “shoe”.

    anchoring String

    Whether the pattern parameter must match the beginning or the end of the query string, or both, or none. Possible values are is, startsWith, endsWith and contains. This parameter goes hand in hand with the pattern parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring.

    Otherwise, you can omit both.

    context String
    Rule context (format: [A-Za-z0-9_-]+). When specified, the Rule is only applied when the same context is specified at query time (using the ruleContexts parameter). When absent, the Rule is generic and always applies (provided that its other conditions are met, of course).
    pattern String

    Query pattern syntax. Query patterns are expressed as a string with a specific syntax. A pattern is a sequence of tokens, which can be either:

    • Facet value placeholder: {facet:$facet_name}. Example: {facet:brand}.
    • Literal: the world itself. Example: Algolia. Special characters (*, {, }, : and \) must be escaped by preceding them with a backslash () if they are to be treated as literals.

    This parameter goes hand in hand with the anchoring parameter. If you’re creating a Rule that depends on a specific query, you must specify the pattern and anchoring. The empty "" pattern is only allowed when anchoring is set to is.

    Otherwise, you can omit both.

    RuleConsequence, RuleConsequenceArgs

    Hides List<string>
    List of object IDs to hide from hits.
    Params RuleConsequenceParams
    Deprecated: Use params_json instead. Additional search parameters. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.

    Deprecated: Deprecated

    ParamsJson string
    Additional search parameters in JSON format. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.
    Promotes List<RuleConsequencePromote>
    Objects to promote as hits.
    UserData string
    Custom JSON formatted string that will be appended to the userData array in the response. This object is not interpreted by the API. It is limited to 1kB of minified JSON.
    Hides []string
    List of object IDs to hide from hits.
    Params RuleConsequenceParams
    Deprecated: Use params_json instead. Additional search parameters. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.

    Deprecated: Deprecated

    ParamsJson string
    Additional search parameters in JSON format. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.
    Promotes []RuleConsequencePromote
    Objects to promote as hits.
    UserData string
    Custom JSON formatted string that will be appended to the userData array in the response. This object is not interpreted by the API. It is limited to 1kB of minified JSON.
    hides List<String>
    List of object IDs to hide from hits.
    params RuleConsequenceParams
    Deprecated: Use params_json instead. Additional search parameters. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.

    Deprecated: Deprecated

    paramsJson String
    Additional search parameters in JSON format. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.
    promotes List<RuleConsequencePromote>
    Objects to promote as hits.
    userData String
    Custom JSON formatted string that will be appended to the userData array in the response. This object is not interpreted by the API. It is limited to 1kB of minified JSON.
    hides string[]
    List of object IDs to hide from hits.
    params RuleConsequenceParams
    Deprecated: Use params_json instead. Additional search parameters. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.

    Deprecated: Deprecated

    paramsJson string
    Additional search parameters in JSON format. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.
    promotes RuleConsequencePromote[]
    Objects to promote as hits.
    userData string
    Custom JSON formatted string that will be appended to the userData array in the response. This object is not interpreted by the API. It is limited to 1kB of minified JSON.
    hides Sequence[str]
    List of object IDs to hide from hits.
    params RuleConsequenceParams
    Deprecated: Use params_json instead. Additional search parameters. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.

    Deprecated: Deprecated

    params_json str
    Additional search parameters in JSON format. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.
    promotes Sequence[RuleConsequencePromote]
    Objects to promote as hits.
    user_data str
    Custom JSON formatted string that will be appended to the userData array in the response. This object is not interpreted by the API. It is limited to 1kB of minified JSON.
    hides List<String>
    List of object IDs to hide from hits.
    params Property Map
    Deprecated: Use params_json instead. Additional search parameters. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.

    Deprecated: Deprecated

    paramsJson String
    Additional search parameters in JSON format. Any valid search parameter is allowed. Specific treatment is applied to these fields: query, automaticFacetFilters, automaticOptionalFacetFilters.
    promotes List<Property Map>
    Objects to promote as hits.
    userData String
    Custom JSON formatted string that will be appended to the userData array in the response. This object is not interpreted by the API. It is limited to 1kB of minified JSON.

    RuleConsequenceParams, RuleConsequenceParamsArgs

    AutomaticFacetFilters List<RuleConsequenceParamsAutomaticFacetFilter>
    Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern.
    AutomaticOptionalFacetFilters List<RuleConsequenceParamsAutomaticOptionalFacetFilter>
    Same syntax as automatic_facet_filters, but the engine treats the filters as optional. Behaves like optionalFilters.
    ObjectQueries List<RuleConsequenceParamsObjectQuery>
    It describes incremental edits to be made to the query string. Either one of query or object_query can be set.
    Query string
    It replaces the entire query string. Either one of query or object_query can be set.
    AutomaticFacetFilters []RuleConsequenceParamsAutomaticFacetFilter
    Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern.
    AutomaticOptionalFacetFilters []RuleConsequenceParamsAutomaticOptionalFacetFilter
    Same syntax as automatic_facet_filters, but the engine treats the filters as optional. Behaves like optionalFilters.
    ObjectQueries []RuleConsequenceParamsObjectQuery
    It describes incremental edits to be made to the query string. Either one of query or object_query can be set.
    Query string
    It replaces the entire query string. Either one of query or object_query can be set.
    automaticFacetFilters List<RuleConsequenceParamsAutomaticFacetFilter>
    Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern.
    automaticOptionalFacetFilters List<RuleConsequenceParamsAutomaticOptionalFacetFilter>
    Same syntax as automatic_facet_filters, but the engine treats the filters as optional. Behaves like optionalFilters.
    objectQueries List<RuleConsequenceParamsObjectQuery>
    It describes incremental edits to be made to the query string. Either one of query or object_query can be set.
    query String
    It replaces the entire query string. Either one of query or object_query can be set.
    automaticFacetFilters RuleConsequenceParamsAutomaticFacetFilter[]
    Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern.
    automaticOptionalFacetFilters RuleConsequenceParamsAutomaticOptionalFacetFilter[]
    Same syntax as automatic_facet_filters, but the engine treats the filters as optional. Behaves like optionalFilters.
    objectQueries RuleConsequenceParamsObjectQuery[]
    It describes incremental edits to be made to the query string. Either one of query or object_query can be set.
    query string
    It replaces the entire query string. Either one of query or object_query can be set.
    automatic_facet_filters Sequence[RuleConsequenceParamsAutomaticFacetFilter]
    Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern.
    automatic_optional_facet_filters Sequence[RuleConsequenceParamsAutomaticOptionalFacetFilter]
    Same syntax as automatic_facet_filters, but the engine treats the filters as optional. Behaves like optionalFilters.
    object_queries Sequence[RuleConsequenceParamsObjectQuery]
    It describes incremental edits to be made to the query string. Either one of query or object_query can be set.
    query str
    It replaces the entire query string. Either one of query or object_query can be set.
    automaticFacetFilters List<Property Map>
    Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern.
    automaticOptionalFacetFilters List<Property Map>
    Same syntax as automatic_facet_filters, but the engine treats the filters as optional. Behaves like optionalFilters.
    objectQueries List<Property Map>
    It describes incremental edits to be made to the query string. Either one of query or object_query can be set.
    query String
    It replaces the entire query string. Either one of query or object_query can be set.

    RuleConsequenceParamsAutomaticFacetFilter, RuleConsequenceParamsAutomaticFacetFilterArgs

    Facet string
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    Disjunctive bool
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    Score double
    Score for the filter. Typically used for optional or disjunctive filters.
    Facet string
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    Disjunctive bool
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    Score float64
    Score for the filter. Typically used for optional or disjunctive filters.
    facet String
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    disjunctive Boolean
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    score Double
    Score for the filter. Typically used for optional or disjunctive filters.
    facet string
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    disjunctive boolean
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    score number
    Score for the filter. Typically used for optional or disjunctive filters.
    facet str
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    disjunctive bool
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    score float
    Score for the filter. Typically used for optional or disjunctive filters.
    facet String
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    disjunctive Boolean
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    score Number
    Score for the filter. Typically used for optional or disjunctive filters.

    RuleConsequenceParamsAutomaticOptionalFacetFilter, RuleConsequenceParamsAutomaticOptionalFacetFilterArgs

    Facet string
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    Disjunctive bool
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    Score double
    Score for the filter. Typically used for optional or disjunctive filters.
    Facet string
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    Disjunctive bool
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    Score float64
    Score for the filter. Typically used for optional or disjunctive filters.
    facet String
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    disjunctive Boolean
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    score Double
    Score for the filter. Typically used for optional or disjunctive filters.
    facet string
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    disjunctive boolean
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    score number
    Score for the filter. Typically used for optional or disjunctive filters.
    facet str
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    disjunctive bool
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    score float
    Score for the filter. Typically used for optional or disjunctive filters.
    facet String
    Attribute to filter on. This must match a facet placeholder in the Rule’s pattern.
    disjunctive Boolean
    Whether the filter is disjunctive (true) or conjunctive (false). If the filter applies multiple times, e.g. because the query string contains multiple values of the same facet, the multiple occurrences are combined with an AND operator by default (conjunctive mode). If the filter is specified as disjunctive, however, multiple occurrences are combined with an OR operator instead.
    score Number
    Score for the filter. Typically used for optional or disjunctive filters.

    RuleConsequenceParamsObjectQuery, RuleConsequenceParamsObjectQueryArgs

    Delete string
    Text or patterns to remove from the query string.
    Type string
    Type of edit. Must be one of: - remove: when you want to delete some text and not replace it with anything - replace: when you want to delete some text and replace it with something else
    Insert string
    Text that should be inserted in place of the removed text inside the query string.
    Delete string
    Text or patterns to remove from the query string.
    Type string
    Type of edit. Must be one of: - remove: when you want to delete some text and not replace it with anything - replace: when you want to delete some text and replace it with something else
    Insert string
    Text that should be inserted in place of the removed text inside the query string.
    delete String
    Text or patterns to remove from the query string.
    type String
    Type of edit. Must be one of: - remove: when you want to delete some text and not replace it with anything - replace: when you want to delete some text and replace it with something else
    insert String
    Text that should be inserted in place of the removed text inside the query string.
    delete string
    Text or patterns to remove from the query string.
    type string
    Type of edit. Must be one of: - remove: when you want to delete some text and not replace it with anything - replace: when you want to delete some text and replace it with something else
    insert string
    Text that should be inserted in place of the removed text inside the query string.
    delete str
    Text or patterns to remove from the query string.
    type str
    Type of edit. Must be one of: - remove: when you want to delete some text and not replace it with anything - replace: when you want to delete some text and replace it with something else
    insert str
    Text that should be inserted in place of the removed text inside the query string.
    delete String
    Text or patterns to remove from the query string.
    type String
    Type of edit. Must be one of: - remove: when you want to delete some text and not replace it with anything - replace: when you want to delete some text and replace it with something else
    insert String
    Text that should be inserted in place of the removed text inside the query string.

    RuleConsequencePromote, RuleConsequencePromoteArgs

    ObjectIds List<string>
    Position double
    The position to promote the object(s) to (zero-based). If you pass object_ids, we place the objects at this position as a group. For example, if you pass four object_ids to position 0, the objects take the first four positions.
    ObjectIds []string
    Position float64
    The position to promote the object(s) to (zero-based). If you pass object_ids, we place the objects at this position as a group. For example, if you pass four object_ids to position 0, the objects take the first four positions.
    objectIds List<String>
    position Double
    The position to promote the object(s) to (zero-based). If you pass object_ids, we place the objects at this position as a group. For example, if you pass four object_ids to position 0, the objects take the first four positions.
    objectIds string[]
    position number
    The position to promote the object(s) to (zero-based). If you pass object_ids, we place the objects at this position as a group. For example, if you pass four object_ids to position 0, the objects take the first four positions.
    object_ids Sequence[str]
    position float
    The position to promote the object(s) to (zero-based). If you pass object_ids, we place the objects at this position as a group. For example, if you pass four object_ids to position 0, the objects take the first four positions.
    objectIds List<String>
    position Number
    The position to promote the object(s) to (zero-based). If you pass object_ids, we place the objects at this position as a group. For example, if you pass four object_ids to position 0, the objects take the first four positions.

    RuleValidity, RuleValidityArgs

    From string
    Lower bound of the time range. RFC3339 format.
    Until string
    Upper bound of the time range. RFC3339 format.
    From string
    Lower bound of the time range. RFC3339 format.
    Until string
    Upper bound of the time range. RFC3339 format.
    from String
    Lower bound of the time range. RFC3339 format.
    until String
    Upper bound of the time range. RFC3339 format.
    from string
    Lower bound of the time range. RFC3339 format.
    until string
    Upper bound of the time range. RFC3339 format.
    from_ str
    Lower bound of the time range. RFC3339 format.
    until str
    Upper bound of the time range. RFC3339 format.
    from String
    Lower bound of the time range. RFC3339 format.
    until String
    Upper bound of the time range. RFC3339 format.

    Import

    $ pulumi import algolia:index/rule:Rule default {{index_name}}/{{object_id}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    algolia k-yomo/terraform-provider-algolia
    License
    Notes
    This Pulumi package is based on the algolia Terraform Provider.
    algolia logo
    algolia 0.6.0 published on Monday, Apr 14, 2025 by k-yomo