1. Packages
  2. Packages
  3. Elasticstack Provider
  4. API Docs
  5. ElasticsearchQueryRuleset
Viewing docs for elasticstack 0.16.1
published on Monday, Jun 1, 2026 by elastic
Viewing docs for elasticstack 0.16.1
published on Monday, Jun 1, 2026 by elastic

    Manages Elasticsearch query rulesets for pinning or excluding search result documents based on contextual criteria. See the Query Rules API documentation for more details.

    NOTE: Minimum Elasticsearch version: 8.16.0. The Query Rules API is GA in 8.12, but the priority field and the exclude rule type exposed by this resource only stabilized in 8.16.

    NOTE: Required cluster privilege: manage_search_query_rules.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as elasticstack from "@pulumi/elasticstack";
    
    const myRuleset = new elasticstack.ElasticsearchQueryRuleset("my_ruleset", {
        rulesetId: "my-search-rules",
        rules: [
            {
                ruleId: "pin-laptops",
                type: "pinned",
                priority: 1,
                criterias: [{
                    type: "exact",
                    metadata: "query",
                    values: JSON.stringify([
                        "laptop",
                        "notebook",
                    ]),
                }],
                actions: {
                    ids: [
                        "doc-1",
                        "doc-2",
                    ],
                },
            },
            {
                ruleId: "exclude-deprecated",
                type: "exclude",
                criterias: [{
                    type: "contains",
                    metadata: "query",
                    values: JSON.stringify(["deprecated"]),
                }],
                actions: {
                    docs: [{
                        _index: "products",
                        _id: "old-1",
                    }],
                },
            },
        ],
    });
    
    import pulumi
    import json
    import pulumi_elasticstack as elasticstack
    
    my_ruleset = elasticstack.ElasticsearchQueryRuleset("my_ruleset",
        ruleset_id="my-search-rules",
        rules=[
            {
                "rule_id": "pin-laptops",
                "type": "pinned",
                "priority": 1,
                "criterias": [{
                    "type": "exact",
                    "metadata": "query",
                    "values": json.dumps([
                        "laptop",
                        "notebook",
                    ]),
                }],
                "actions": {
                    "ids": [
                        "doc-1",
                        "doc-2",
                    ],
                },
            },
            {
                "rule_id": "exclude-deprecated",
                "type": "exclude",
                "criterias": [{
                    "type": "contains",
                    "metadata": "query",
                    "values": json.dumps(["deprecated"]),
                }],
                "actions": {
                    "docs": [{
                        "_index": "products",
                        "_id": "old-1",
                    }],
                },
            },
        ])
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/elasticstack/elasticstack"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		tmpJSON0, err := json.Marshal([]string{
    			"laptop",
    			"notebook",
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		tmpJSON1, err := json.Marshal([]string{
    			"deprecated",
    		})
    		if err != nil {
    			return err
    		}
    		json1 := string(tmpJSON1)
    		_, err = elasticstack.NewElasticsearchQueryRuleset(ctx, "my_ruleset", &elasticstack.ElasticsearchQueryRulesetArgs{
    			RulesetId: pulumi.String("my-search-rules"),
    			Rules: elasticstack.ElasticsearchQueryRulesetRuleArray{
    				&elasticstack.ElasticsearchQueryRulesetRuleArgs{
    					RuleId:   pulumi.String("pin-laptops"),
    					Type:     pulumi.String("pinned"),
    					Priority: pulumi.Float64(1),
    					Criterias: elasticstack.ElasticsearchQueryRulesetRuleCriteriaArray{
    						&elasticstack.ElasticsearchQueryRulesetRuleCriteriaArgs{
    							Type:     pulumi.String("exact"),
    							Metadata: pulumi.String("query"),
    							Values:   pulumi.String(json0),
    						},
    					},
    					Actions: &elasticstack.ElasticsearchQueryRulesetRuleActionsArgs{
    						Ids: pulumi.StringArray{
    							pulumi.String("doc-1"),
    							pulumi.String("doc-2"),
    						},
    					},
    				},
    				&elasticstack.ElasticsearchQueryRulesetRuleArgs{
    					RuleId: pulumi.String("exclude-deprecated"),
    					Type:   pulumi.String("exclude"),
    					Criterias: elasticstack.ElasticsearchQueryRulesetRuleCriteriaArray{
    						&elasticstack.ElasticsearchQueryRulesetRuleCriteriaArgs{
    							Type:     pulumi.String("contains"),
    							Metadata: pulumi.String("query"),
    							Values:   pulumi.String(json1),
    						},
    					},
    					Actions: &elasticstack.ElasticsearchQueryRulesetRuleActionsArgs{
    						Docs: elasticstack.ElasticsearchQueryRulesetRuleActionsDocArray{
    							&elasticstack.ElasticsearchQueryRulesetRuleActionsDocArgs{
    								_index: pulumi.String("products"),
    								_id:    pulumi.String("old-1"),
    							},
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Elasticstack = Pulumi.Elasticstack;
    
    return await Deployment.RunAsync(() => 
    {
        var myRuleset = new Elasticstack.ElasticsearchQueryRuleset("my_ruleset", new()
        {
            RulesetId = "my-search-rules",
            Rules = new[]
            {
                new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleArgs
                {
                    RuleId = "pin-laptops",
                    Type = "pinned",
                    Priority = 1,
                    Criterias = new[]
                    {
                        new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleCriteriaArgs
                        {
                            Type = "exact",
                            Metadata = "query",
                            Values = JsonSerializer.Serialize(new[]
                            {
                                "laptop",
                                "notebook",
                            }),
                        },
                    },
                    Actions = new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleActionsArgs
                    {
                        Ids = new[]
                        {
                            "doc-1",
                            "doc-2",
                        },
                    },
                },
                new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleArgs
                {
                    RuleId = "exclude-deprecated",
                    Type = "exclude",
                    Criterias = new[]
                    {
                        new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleCriteriaArgs
                        {
                            Type = "contains",
                            Metadata = "query",
                            Values = JsonSerializer.Serialize(new[]
                            {
                                "deprecated",
                            }),
                        },
                    },
                    Actions = new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleActionsArgs
                    {
                        Docs = new[]
                        {
                            new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleActionsDocArgs
                            {
                                _index = "products",
                                _id = "old-1",
                            },
                        },
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.elasticstack.ElasticsearchQueryRuleset;
    import com.pulumi.elasticstack.ElasticsearchQueryRulesetArgs;
    import com.pulumi.elasticstack.inputs.ElasticsearchQueryRulesetRuleArgs;
    import com.pulumi.elasticstack.inputs.ElasticsearchQueryRulesetRuleActionsArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 myRuleset = new ElasticsearchQueryRuleset("myRuleset", ElasticsearchQueryRulesetArgs.builder()
                .rulesetId("my-search-rules")
                .rules(            
                    ElasticsearchQueryRulesetRuleArgs.builder()
                        .ruleId("pin-laptops")
                        .type("pinned")
                        .priority(1.0)
                        .criterias(ElasticsearchQueryRulesetRuleCriteriaArgs.builder()
                            .type("exact")
                            .metadata("query")
                            .values(serializeJson(
                                jsonArray(
                                    "laptop", 
                                    "notebook"
                                )))
                            .build())
                        .actions(ElasticsearchQueryRulesetRuleActionsArgs.builder()
                            .ids(                        
                                "doc-1",
                                "doc-2")
                            .build())
                        .build(),
                    ElasticsearchQueryRulesetRuleArgs.builder()
                        .ruleId("exclude-deprecated")
                        .type("exclude")
                        .criterias(ElasticsearchQueryRulesetRuleCriteriaArgs.builder()
                            .type("contains")
                            .metadata("query")
                            .values(serializeJson(
                                jsonArray("deprecated")))
                            .build())
                        .actions(ElasticsearchQueryRulesetRuleActionsArgs.builder()
                            .docs(ElasticsearchQueryRulesetRuleActionsDocArgs.builder()
                                ._index("products")
                                ._id("old-1")
                                .build())
                            .build())
                        .build())
                .build());
    
        }
    }
    
    resources:
      myRuleset:
        type: elasticstack:ElasticsearchQueryRuleset
        name: my_ruleset
        properties:
          rulesetId: my-search-rules
          rules:
            - ruleId: pin-laptops
              type: pinned
              priority: 1
              criterias:
                - type: exact
                  metadata: query
                  values:
                    fn::toJSON:
                      - laptop
                      - notebook
              actions:
                ids:
                  - doc-1
                  - doc-2
            - ruleId: exclude-deprecated
              type: exclude
              criterias:
                - type: contains
                  metadata: query
                  values:
                    fn::toJSON:
                      - deprecated
              actions:
                docs:
                  - _index: products
                    _id: old-1
    
    Example coming soon!
    

    Create ElasticsearchQueryRuleset Resource

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

    Constructor syntax

    new ElasticsearchQueryRuleset(name: string, args: ElasticsearchQueryRulesetArgs, opts?: CustomResourceOptions);
    @overload
    def ElasticsearchQueryRuleset(resource_name: str,
                                  args: ElasticsearchQueryRulesetArgs,
                                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def ElasticsearchQueryRuleset(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  rules: Optional[Sequence[ElasticsearchQueryRulesetRuleArgs]] = None,
                                  ruleset_id: Optional[str] = None,
                                  elasticsearch_connections: Optional[Sequence[ElasticsearchQueryRulesetElasticsearchConnectionArgs]] = None)
    func NewElasticsearchQueryRuleset(ctx *Context, name string, args ElasticsearchQueryRulesetArgs, opts ...ResourceOption) (*ElasticsearchQueryRuleset, error)
    public ElasticsearchQueryRuleset(string name, ElasticsearchQueryRulesetArgs args, CustomResourceOptions? opts = null)
    public ElasticsearchQueryRuleset(String name, ElasticsearchQueryRulesetArgs args)
    public ElasticsearchQueryRuleset(String name, ElasticsearchQueryRulesetArgs args, CustomResourceOptions options)
    
    type: elasticstack:ElasticsearchQueryRuleset
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "elasticstack_elasticsearchqueryruleset" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ElasticsearchQueryRulesetArgs
    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 ElasticsearchQueryRulesetArgs
    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 ElasticsearchQueryRulesetArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ElasticsearchQueryRulesetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ElasticsearchQueryRulesetArgs
    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 elasticsearchQueryRulesetResource = new Elasticstack.ElasticsearchQueryRuleset("elasticsearchQueryRulesetResource", new()
    {
        Rules = new[]
        {
            new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleArgs
            {
                Actions = new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleActionsArgs
                {
                    Docs = new[]
                    {
                        new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleActionsDocArgs
                        {
                            _id = "string",
                            _index = "string",
                        },
                    },
                    Ids = new[]
                    {
                        "string",
                    },
                },
                Criterias = new[]
                {
                    new Elasticstack.Inputs.ElasticsearchQueryRulesetRuleCriteriaArgs
                    {
                        Type = "string",
                        Metadata = "string",
                        Values = "string",
                    },
                },
                RuleId = "string",
                Type = "string",
                Priority = 0,
            },
        },
        RulesetId = "string",
        ElasticsearchConnections = new[]
        {
            new Elasticstack.Inputs.ElasticsearchQueryRulesetElasticsearchConnectionArgs
            {
                ApiKey = "string",
                BearerToken = "string",
                CaData = "string",
                CaFile = "string",
                CertData = "string",
                CertFile = "string",
                Endpoints = new[]
                {
                    "string",
                },
                EsClientAuthentication = "string",
                Headers = 
                {
                    { "string", "string" },
                },
                Insecure = false,
                KeyData = "string",
                KeyFile = "string",
                Password = "string",
                Username = "string",
            },
        },
    });
    
    example, err := elasticstack.NewElasticsearchQueryRuleset(ctx, "elasticsearchQueryRulesetResource", &elasticstack.ElasticsearchQueryRulesetArgs{
    	Rules: elasticstack.ElasticsearchQueryRulesetRuleArray{
    		&elasticstack.ElasticsearchQueryRulesetRuleArgs{
    			Actions: &elasticstack.ElasticsearchQueryRulesetRuleActionsArgs{
    				Docs: elasticstack.ElasticsearchQueryRulesetRuleActionsDocArray{
    					&elasticstack.ElasticsearchQueryRulesetRuleActionsDocArgs{
    						_id:    pulumi.String("string"),
    						_index: pulumi.String("string"),
    					},
    				},
    				Ids: pulumi.StringArray{
    					pulumi.String("string"),
    				},
    			},
    			Criterias: elasticstack.ElasticsearchQueryRulesetRuleCriteriaArray{
    				&elasticstack.ElasticsearchQueryRulesetRuleCriteriaArgs{
    					Type:     pulumi.String("string"),
    					Metadata: pulumi.String("string"),
    					Values:   pulumi.String("string"),
    				},
    			},
    			RuleId:   pulumi.String("string"),
    			Type:     pulumi.String("string"),
    			Priority: pulumi.Float64(0),
    		},
    	},
    	RulesetId: pulumi.String("string"),
    	ElasticsearchConnections: elasticstack.ElasticsearchQueryRulesetElasticsearchConnectionArray{
    		&elasticstack.ElasticsearchQueryRulesetElasticsearchConnectionArgs{
    			ApiKey:      pulumi.String("string"),
    			BearerToken: pulumi.String("string"),
    			CaData:      pulumi.String("string"),
    			CaFile:      pulumi.String("string"),
    			CertData:    pulumi.String("string"),
    			CertFile:    pulumi.String("string"),
    			Endpoints: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			EsClientAuthentication: pulumi.String("string"),
    			Headers: pulumi.StringMap{
    				"string": pulumi.String("string"),
    			},
    			Insecure: pulumi.Bool(false),
    			KeyData:  pulumi.String("string"),
    			KeyFile:  pulumi.String("string"),
    			Password: pulumi.String("string"),
    			Username: pulumi.String("string"),
    		},
    	},
    })
    
    resource "elasticstack_elasticsearchqueryruleset" "elasticsearchQueryRulesetResource" {
      rules {
        actions = {
          docs = [{
            "_id"    = "string"
            "_index" = "string"
          }]
          ids = ["string"]
        }
        criterias {
          type     = "string"
          metadata = "string"
          values   = "string"
        }
        rule_id  = "string"
        type     = "string"
        priority = 0
      }
      ruleset_id = "string"
      elasticsearch_connections {
        api_key                  = "string"
        bearer_token             = "string"
        ca_data                  = "string"
        ca_file                  = "string"
        cert_data                = "string"
        cert_file                = "string"
        endpoints                = ["string"]
        es_client_authentication = "string"
        headers = {
          "string" = "string"
        }
        insecure = false
        key_data = "string"
        key_file = "string"
        password = "string"
        username = "string"
      }
    }
    
    var elasticsearchQueryRulesetResource = new ElasticsearchQueryRuleset("elasticsearchQueryRulesetResource", ElasticsearchQueryRulesetArgs.builder()
        .rules(ElasticsearchQueryRulesetRuleArgs.builder()
            .actions(ElasticsearchQueryRulesetRuleActionsArgs.builder()
                .docs(ElasticsearchQueryRulesetRuleActionsDocArgs.builder()
                    ._id("string")
                    ._index("string")
                    .build())
                .ids("string")
                .build())
            .criterias(ElasticsearchQueryRulesetRuleCriteriaArgs.builder()
                .type("string")
                .metadata("string")
                .values("string")
                .build())
            .ruleId("string")
            .type("string")
            .priority(0.0)
            .build())
        .rulesetId("string")
        .elasticsearchConnections(ElasticsearchQueryRulesetElasticsearchConnectionArgs.builder()
            .apiKey("string")
            .bearerToken("string")
            .caData("string")
            .caFile("string")
            .certData("string")
            .certFile("string")
            .endpoints("string")
            .esClientAuthentication("string")
            .headers(Map.of("string", "string"))
            .insecure(false)
            .keyData("string")
            .keyFile("string")
            .password("string")
            .username("string")
            .build())
        .build());
    
    elasticsearch_query_ruleset_resource = elasticstack.ElasticsearchQueryRuleset("elasticsearchQueryRulesetResource",
        rules=[{
            "actions": {
                "docs": [{
                    "_id": "string",
                    "_index": "string",
                }],
                "ids": ["string"],
            },
            "criterias": [{
                "type": "string",
                "metadata": "string",
                "values": "string",
            }],
            "rule_id": "string",
            "type": "string",
            "priority": float(0),
        }],
        ruleset_id="string",
        elasticsearch_connections=[{
            "api_key": "string",
            "bearer_token": "string",
            "ca_data": "string",
            "ca_file": "string",
            "cert_data": "string",
            "cert_file": "string",
            "endpoints": ["string"],
            "es_client_authentication": "string",
            "headers": {
                "string": "string",
            },
            "insecure": False,
            "key_data": "string",
            "key_file": "string",
            "password": "string",
            "username": "string",
        }])
    
    const elasticsearchQueryRulesetResource = new elasticstack.ElasticsearchQueryRuleset("elasticsearchQueryRulesetResource", {
        rules: [{
            actions: {
                docs: [{
                    _id: "string",
                    _index: "string",
                }],
                ids: ["string"],
            },
            criterias: [{
                type: "string",
                metadata: "string",
                values: "string",
            }],
            ruleId: "string",
            type: "string",
            priority: 0,
        }],
        rulesetId: "string",
        elasticsearchConnections: [{
            apiKey: "string",
            bearerToken: "string",
            caData: "string",
            caFile: "string",
            certData: "string",
            certFile: "string",
            endpoints: ["string"],
            esClientAuthentication: "string",
            headers: {
                string: "string",
            },
            insecure: false,
            keyData: "string",
            keyFile: "string",
            password: "string",
            username: "string",
        }],
    });
    
    type: elasticstack:ElasticsearchQueryRuleset
    properties:
        elasticsearchConnections:
            - apiKey: string
              bearerToken: string
              caData: string
              caFile: string
              certData: string
              certFile: string
              endpoints:
                - string
              esClientAuthentication: string
              headers:
                string: string
              insecure: false
              keyData: string
              keyFile: string
              password: string
              username: string
        rules:
            - actions:
                docs:
                    - _id: string
                      _index: string
                ids:
                    - string
              criterias:
                - metadata: string
                  type: string
                  values: string
              priority: 0
              ruleId: string
              type: string
        rulesetId: string
    

    ElasticsearchQueryRuleset 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 ElasticsearchQueryRuleset resource accepts the following input properties:

    Rules List<ElasticsearchQueryRulesetRule>
    Ordered list of query rules for this ruleset.
    RulesetId string
    Unique identifier for the query ruleset.
    ElasticsearchConnections List<ElasticsearchQueryRulesetElasticsearchConnection>
    Elasticsearch connection configuration block.
    Rules []ElasticsearchQueryRulesetRuleArgs
    Ordered list of query rules for this ruleset.
    RulesetId string
    Unique identifier for the query ruleset.
    ElasticsearchConnections []ElasticsearchQueryRulesetElasticsearchConnectionArgs
    Elasticsearch connection configuration block.
    rules list(object)
    Ordered list of query rules for this ruleset.
    ruleset_id string
    Unique identifier for the query ruleset.
    elasticsearch_connections list(object)
    Elasticsearch connection configuration block.
    rules List<ElasticsearchQueryRulesetRule>
    Ordered list of query rules for this ruleset.
    rulesetId String
    Unique identifier for the query ruleset.
    elasticsearchConnections List<ElasticsearchQueryRulesetElasticsearchConnection>
    Elasticsearch connection configuration block.
    rules ElasticsearchQueryRulesetRule[]
    Ordered list of query rules for this ruleset.
    rulesetId string
    Unique identifier for the query ruleset.
    elasticsearchConnections ElasticsearchQueryRulesetElasticsearchConnection[]
    Elasticsearch connection configuration block.
    rules Sequence[ElasticsearchQueryRulesetRuleArgs]
    Ordered list of query rules for this ruleset.
    ruleset_id str
    Unique identifier for the query ruleset.
    elasticsearch_connections Sequence[ElasticsearchQueryRulesetElasticsearchConnectionArgs]
    Elasticsearch connection configuration block.
    rules List<Property Map>
    Ordered list of query rules for this ruleset.
    rulesetId String
    Unique identifier for the query ruleset.
    elasticsearchConnections List<Property Map>
    Elasticsearch connection configuration block.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ElasticsearchQueryRuleset 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 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 ElasticsearchQueryRuleset Resource

    Get an existing ElasticsearchQueryRuleset 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?: ElasticsearchQueryRulesetState, opts?: CustomResourceOptions): ElasticsearchQueryRuleset
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            elasticsearch_connections: Optional[Sequence[ElasticsearchQueryRulesetElasticsearchConnectionArgs]] = None,
            rules: Optional[Sequence[ElasticsearchQueryRulesetRuleArgs]] = None,
            ruleset_id: Optional[str] = None) -> ElasticsearchQueryRuleset
    func GetElasticsearchQueryRuleset(ctx *Context, name string, id IDInput, state *ElasticsearchQueryRulesetState, opts ...ResourceOption) (*ElasticsearchQueryRuleset, error)
    public static ElasticsearchQueryRuleset Get(string name, Input<string> id, ElasticsearchQueryRulesetState? state, CustomResourceOptions? opts = null)
    public static ElasticsearchQueryRuleset get(String name, Output<String> id, ElasticsearchQueryRulesetState state, CustomResourceOptions options)
    resources:  _:    type: elasticstack:ElasticsearchQueryRuleset    get:      id: ${id}
    import {
      to = elasticstack_elasticsearchqueryruleset.example
      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:
    ElasticsearchConnections List<ElasticsearchQueryRulesetElasticsearchConnection>
    Elasticsearch connection configuration block.
    Rules List<ElasticsearchQueryRulesetRule>
    Ordered list of query rules for this ruleset.
    RulesetId string
    Unique identifier for the query ruleset.
    ElasticsearchConnections []ElasticsearchQueryRulesetElasticsearchConnectionArgs
    Elasticsearch connection configuration block.
    Rules []ElasticsearchQueryRulesetRuleArgs
    Ordered list of query rules for this ruleset.
    RulesetId string
    Unique identifier for the query ruleset.
    elasticsearch_connections list(object)
    Elasticsearch connection configuration block.
    rules list(object)
    Ordered list of query rules for this ruleset.
    ruleset_id string
    Unique identifier for the query ruleset.
    elasticsearchConnections List<ElasticsearchQueryRulesetElasticsearchConnection>
    Elasticsearch connection configuration block.
    rules List<ElasticsearchQueryRulesetRule>
    Ordered list of query rules for this ruleset.
    rulesetId String
    Unique identifier for the query ruleset.
    elasticsearchConnections ElasticsearchQueryRulesetElasticsearchConnection[]
    Elasticsearch connection configuration block.
    rules ElasticsearchQueryRulesetRule[]
    Ordered list of query rules for this ruleset.
    rulesetId string
    Unique identifier for the query ruleset.
    elasticsearch_connections Sequence[ElasticsearchQueryRulesetElasticsearchConnectionArgs]
    Elasticsearch connection configuration block.
    rules Sequence[ElasticsearchQueryRulesetRuleArgs]
    Ordered list of query rules for this ruleset.
    ruleset_id str
    Unique identifier for the query ruleset.
    elasticsearchConnections List<Property Map>
    Elasticsearch connection configuration block.
    rules List<Property Map>
    Ordered list of query rules for this ruleset.
    rulesetId String
    Unique identifier for the query ruleset.

    Supporting Types

    ElasticsearchQueryRulesetElasticsearchConnection, ElasticsearchQueryRulesetElasticsearchConnectionArgs

    ApiKey string
    API Key to use for authentication to Elasticsearch
    BearerToken string
    Bearer Token to use for authentication to Elasticsearch
    CaData string
    PEM-encoded custom Certificate Authority certificate
    CaFile string
    Path to a custom Certificate Authority certificate
    CertData string
    PEM encoded certificate for client auth
    CertFile string
    Path to a file containing the PEM encoded certificate for client auth
    Endpoints List<string>
    EsClientAuthentication string
    ES Client Authentication field to be used with the JWT token
    Headers Dictionary<string, string>
    A list of headers to be sent with each request to Elasticsearch.
    Insecure bool
    Disable TLS certificate validation
    KeyData string
    PEM encoded private key for client auth
    KeyFile string
    Path to a file containing the PEM encoded private key for client auth
    Password string
    Password to use for API authentication to Elasticsearch.
    Username string
    Username to use for API authentication to Elasticsearch.
    ApiKey string
    API Key to use for authentication to Elasticsearch
    BearerToken string
    Bearer Token to use for authentication to Elasticsearch
    CaData string
    PEM-encoded custom Certificate Authority certificate
    CaFile string
    Path to a custom Certificate Authority certificate
    CertData string
    PEM encoded certificate for client auth
    CertFile string
    Path to a file containing the PEM encoded certificate for client auth
    Endpoints []string
    EsClientAuthentication string
    ES Client Authentication field to be used with the JWT token
    Headers map[string]string
    A list of headers to be sent with each request to Elasticsearch.
    Insecure bool
    Disable TLS certificate validation
    KeyData string
    PEM encoded private key for client auth
    KeyFile string
    Path to a file containing the PEM encoded private key for client auth
    Password string
    Password to use for API authentication to Elasticsearch.
    Username string
    Username to use for API authentication to Elasticsearch.
    api_key string
    API Key to use for authentication to Elasticsearch
    bearer_token string
    Bearer Token to use for authentication to Elasticsearch
    ca_data string
    PEM-encoded custom Certificate Authority certificate
    ca_file string
    Path to a custom Certificate Authority certificate
    cert_data string
    PEM encoded certificate for client auth
    cert_file string
    Path to a file containing the PEM encoded certificate for client auth
    endpoints list(string)
    es_client_authentication string
    ES Client Authentication field to be used with the JWT token
    headers map(string)
    A list of headers to be sent with each request to Elasticsearch.
    insecure bool
    Disable TLS certificate validation
    key_data string
    PEM encoded private key for client auth
    key_file string
    Path to a file containing the PEM encoded private key for client auth
    password string
    Password to use for API authentication to Elasticsearch.
    username string
    Username to use for API authentication to Elasticsearch.
    apiKey String
    API Key to use for authentication to Elasticsearch
    bearerToken String
    Bearer Token to use for authentication to Elasticsearch
    caData String
    PEM-encoded custom Certificate Authority certificate
    caFile String
    Path to a custom Certificate Authority certificate
    certData String
    PEM encoded certificate for client auth
    certFile String
    Path to a file containing the PEM encoded certificate for client auth
    endpoints List<String>
    esClientAuthentication String
    ES Client Authentication field to be used with the JWT token
    headers Map<String,String>
    A list of headers to be sent with each request to Elasticsearch.
    insecure Boolean
    Disable TLS certificate validation
    keyData String
    PEM encoded private key for client auth
    keyFile String
    Path to a file containing the PEM encoded private key for client auth
    password String
    Password to use for API authentication to Elasticsearch.
    username String
    Username to use for API authentication to Elasticsearch.
    apiKey string
    API Key to use for authentication to Elasticsearch
    bearerToken string
    Bearer Token to use for authentication to Elasticsearch
    caData string
    PEM-encoded custom Certificate Authority certificate
    caFile string
    Path to a custom Certificate Authority certificate
    certData string
    PEM encoded certificate for client auth
    certFile string
    Path to a file containing the PEM encoded certificate for client auth
    endpoints string[]
    esClientAuthentication string
    ES Client Authentication field to be used with the JWT token
    headers {[key: string]: string}
    A list of headers to be sent with each request to Elasticsearch.
    insecure boolean
    Disable TLS certificate validation
    keyData string
    PEM encoded private key for client auth
    keyFile string
    Path to a file containing the PEM encoded private key for client auth
    password string
    Password to use for API authentication to Elasticsearch.
    username string
    Username to use for API authentication to Elasticsearch.
    api_key str
    API Key to use for authentication to Elasticsearch
    bearer_token str
    Bearer Token to use for authentication to Elasticsearch
    ca_data str
    PEM-encoded custom Certificate Authority certificate
    ca_file str
    Path to a custom Certificate Authority certificate
    cert_data str
    PEM encoded certificate for client auth
    cert_file str
    Path to a file containing the PEM encoded certificate for client auth
    endpoints Sequence[str]
    es_client_authentication str
    ES Client Authentication field to be used with the JWT token
    headers Mapping[str, str]
    A list of headers to be sent with each request to Elasticsearch.
    insecure bool
    Disable TLS certificate validation
    key_data str
    PEM encoded private key for client auth
    key_file str
    Path to a file containing the PEM encoded private key for client auth
    password str
    Password to use for API authentication to Elasticsearch.
    username str
    Username to use for API authentication to Elasticsearch.
    apiKey String
    API Key to use for authentication to Elasticsearch
    bearerToken String
    Bearer Token to use for authentication to Elasticsearch
    caData String
    PEM-encoded custom Certificate Authority certificate
    caFile String
    Path to a custom Certificate Authority certificate
    certData String
    PEM encoded certificate for client auth
    certFile String
    Path to a file containing the PEM encoded certificate for client auth
    endpoints List<String>
    esClientAuthentication String
    ES Client Authentication field to be used with the JWT token
    headers Map<String>
    A list of headers to be sent with each request to Elasticsearch.
    insecure Boolean
    Disable TLS certificate validation
    keyData String
    PEM encoded private key for client auth
    keyFile String
    Path to a file containing the PEM encoded private key for client auth
    password String
    Password to use for API authentication to Elasticsearch.
    username String
    Username to use for API authentication to Elasticsearch.

    ElasticsearchQueryRulesetRule, ElasticsearchQueryRulesetRuleArgs

    Actions ElasticsearchQueryRulesetRuleActions
    Actions to take when the rule matches; exactly one of ids or docs must be set.
    Criterias List<ElasticsearchQueryRulesetRuleCriteria>
    Match criteria for the rule; all criteria must match for the rule to apply.
    RuleId string
    Unique identifier for the rule within the ruleset.
    Type string
    Rule type: pinned or exclude.
    Priority double
    Relative priority within the ruleset; omitted from the API when null.
    Actions ElasticsearchQueryRulesetRuleActions
    Actions to take when the rule matches; exactly one of ids or docs must be set.
    Criterias []ElasticsearchQueryRulesetRuleCriteria
    Match criteria for the rule; all criteria must match for the rule to apply.
    RuleId string
    Unique identifier for the rule within the ruleset.
    Type string
    Rule type: pinned or exclude.
    Priority float64
    Relative priority within the ruleset; omitted from the API when null.
    actions object
    Actions to take when the rule matches; exactly one of ids or docs must be set.
    criterias list(object)
    Match criteria for the rule; all criteria must match for the rule to apply.
    rule_id string
    Unique identifier for the rule within the ruleset.
    type string
    Rule type: pinned or exclude.
    priority number
    Relative priority within the ruleset; omitted from the API when null.
    actions ElasticsearchQueryRulesetRuleActions
    Actions to take when the rule matches; exactly one of ids or docs must be set.
    criterias List<ElasticsearchQueryRulesetRuleCriteria>
    Match criteria for the rule; all criteria must match for the rule to apply.
    ruleId String
    Unique identifier for the rule within the ruleset.
    type String
    Rule type: pinned or exclude.
    priority Double
    Relative priority within the ruleset; omitted from the API when null.
    actions ElasticsearchQueryRulesetRuleActions
    Actions to take when the rule matches; exactly one of ids or docs must be set.
    criterias ElasticsearchQueryRulesetRuleCriteria[]
    Match criteria for the rule; all criteria must match for the rule to apply.
    ruleId string
    Unique identifier for the rule within the ruleset.
    type string
    Rule type: pinned or exclude.
    priority number
    Relative priority within the ruleset; omitted from the API when null.
    actions ElasticsearchQueryRulesetRuleActions
    Actions to take when the rule matches; exactly one of ids or docs must be set.
    criterias Sequence[ElasticsearchQueryRulesetRuleCriteria]
    Match criteria for the rule; all criteria must match for the rule to apply.
    rule_id str
    Unique identifier for the rule within the ruleset.
    type str
    Rule type: pinned or exclude.
    priority float
    Relative priority within the ruleset; omitted from the API when null.
    actions Property Map
    Actions to take when the rule matches; exactly one of ids or docs must be set.
    criterias List<Property Map>
    Match criteria for the rule; all criteria must match for the rule to apply.
    ruleId String
    Unique identifier for the rule within the ruleset.
    type String
    Rule type: pinned or exclude.
    priority Number
    Relative priority within the ruleset; omitted from the API when null.

    ElasticsearchQueryRulesetRuleActions, ElasticsearchQueryRulesetRuleActionsArgs

    Docs List<ElasticsearchQueryRulesetRuleActionsDoc>
    Documents to pin or exclude, specified by index and ID.
    Ids List<string>
    Document IDs to pin or exclude.
    Docs []ElasticsearchQueryRulesetRuleActionsDoc
    Documents to pin or exclude, specified by index and ID.
    Ids []string
    Document IDs to pin or exclude.
    docs list(object)
    Documents to pin or exclude, specified by index and ID.
    ids list(string)
    Document IDs to pin or exclude.
    docs List<ElasticsearchQueryRulesetRuleActionsDoc>
    Documents to pin or exclude, specified by index and ID.
    ids List<String>
    Document IDs to pin or exclude.
    docs ElasticsearchQueryRulesetRuleActionsDoc[]
    Documents to pin or exclude, specified by index and ID.
    ids string[]
    Document IDs to pin or exclude.
    docs Sequence[ElasticsearchQueryRulesetRuleActionsDoc]
    Documents to pin or exclude, specified by index and ID.
    ids Sequence[str]
    Document IDs to pin or exclude.
    docs List<Property Map>
    Documents to pin or exclude, specified by index and ID.
    ids List<String>
    Document IDs to pin or exclude.

    ElasticsearchQueryRulesetRuleActionsDoc, ElasticsearchQueryRulesetRuleActionsDocArgs

    _id string
    Unique document ID.
    _index string
    Index containing the document.
    _id string
    Unique document ID.
    _index string
    Index containing the document.
    _id string
    Unique document ID.
    _index string
    Index containing the document.
    _id String
    Unique document ID.
    _index String
    Index containing the document.
    _id string
    Unique document ID.
    _index string
    Index containing the document.
    _id str
    Unique document ID.
    _index str
    Index containing the document.
    _id String
    Unique document ID.
    _index String
    Index containing the document.

    ElasticsearchQueryRulesetRuleCriteria, ElasticsearchQueryRulesetRuleCriteriaArgs

    Type string
    Criteria type (for example exact, always, gt).
    Metadata string
    Metadata field to match against; omitted from the API when null.
    Values string
    JSON-encoded array of string or numeric values; required unless type is always. Empty arrays are not allowed.
    Type string
    Criteria type (for example exact, always, gt).
    Metadata string
    Metadata field to match against; omitted from the API when null.
    Values string
    JSON-encoded array of string or numeric values; required unless type is always. Empty arrays are not allowed.
    type string
    Criteria type (for example exact, always, gt).
    metadata string
    Metadata field to match against; omitted from the API when null.
    values string
    JSON-encoded array of string or numeric values; required unless type is always. Empty arrays are not allowed.
    type String
    Criteria type (for example exact, always, gt).
    metadata String
    Metadata field to match against; omitted from the API when null.
    values String
    JSON-encoded array of string or numeric values; required unless type is always. Empty arrays are not allowed.
    type string
    Criteria type (for example exact, always, gt).
    metadata string
    Metadata field to match against; omitted from the API when null.
    values string
    JSON-encoded array of string or numeric values; required unless type is always. Empty arrays are not allowed.
    type str
    Criteria type (for example exact, always, gt).
    metadata str
    Metadata field to match against; omitted from the API when null.
    values str
    JSON-encoded array of string or numeric values; required unless type is always. Empty arrays are not allowed.
    type String
    Criteria type (for example exact, always, gt).
    metadata String
    Metadata field to match against; omitted from the API when null.
    values String
    JSON-encoded array of string or numeric values; required unless type is always. Empty arrays are not allowed.

    Import

    The pulumi import command can be used, for example:

    $ pulumi import elasticstack:index/elasticsearchQueryRuleset:ElasticsearchQueryRuleset my_ruleset <cluster_uuid>/<ruleset_id>
    

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

    Package Details

    Repository
    elasticstack elastic/terraform-provider-elasticstack
    License
    Notes
    This Pulumi package is based on the elasticstack Terraform Provider.
    Viewing docs for elasticstack 0.16.1
    published on Monday, Jun 1, 2026 by elastic

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial