1. Packages
  2. Packages
  3. Elasticstack Provider
  4. API Docs
  5. ElasticsearchMlJobState
Viewing docs for elasticstack 0.15.0
published on Thursday, May 14, 2026 by elastic
Viewing docs for elasticstack 0.15.0
published on Thursday, May 14, 2026 by elastic

    Manages the state of an Elasticsearch Machine Learning (ML) job, allowing you to open or close ML jobs.

    This resource uses the following Elasticsearch APIs:

    Create ElasticsearchMlJobState Resource

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

    Constructor syntax

    new ElasticsearchMlJobState(name: string, args: ElasticsearchMlJobStateArgs, opts?: CustomResourceOptions);
    @overload
    def ElasticsearchMlJobState(resource_name: str,
                                args: ElasticsearchMlJobStateArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def ElasticsearchMlJobState(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                job_id: Optional[str] = None,
                                state: Optional[str] = None,
                                elasticsearch_connections: Optional[Sequence[ElasticsearchMlJobStateElasticsearchConnectionArgs]] = None,
                                force: Optional[bool] = None,
                                job_timeout: Optional[str] = None,
                                timeouts: Optional[ElasticsearchMlJobStateTimeoutsArgs] = None)
    func NewElasticsearchMlJobState(ctx *Context, name string, args ElasticsearchMlJobStateArgs, opts ...ResourceOption) (*ElasticsearchMlJobState, error)
    public ElasticsearchMlJobState(string name, ElasticsearchMlJobStateArgs args, CustomResourceOptions? opts = null)
    public ElasticsearchMlJobState(String name, ElasticsearchMlJobStateArgs args)
    public ElasticsearchMlJobState(String name, ElasticsearchMlJobStateArgs args, CustomResourceOptions options)
    
    type: elasticstack:ElasticsearchMlJobState
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "elasticstack_elasticsearchmljobstate" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ElasticsearchMlJobStateArgs
    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 ElasticsearchMlJobStateArgs
    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 ElasticsearchMlJobStateArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ElasticsearchMlJobStateArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ElasticsearchMlJobStateArgs
    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 elasticsearchMlJobStateResource = new Elasticstack.ElasticsearchMlJobState("elasticsearchMlJobStateResource", new()
    {
        JobId = "string",
        State = "string",
        ElasticsearchConnections = new[]
        {
            new Elasticstack.Inputs.ElasticsearchMlJobStateElasticsearchConnectionArgs
            {
                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",
            },
        },
        Force = false,
        JobTimeout = "string",
        Timeouts = new Elasticstack.Inputs.ElasticsearchMlJobStateTimeoutsArgs
        {
            Create = "string",
            Update = "string",
        },
    });
    
    example, err := elasticstack.NewElasticsearchMlJobState(ctx, "elasticsearchMlJobStateResource", &elasticstack.ElasticsearchMlJobStateArgs{
    	JobId: pulumi.String("string"),
    	State: pulumi.String("string"),
    	ElasticsearchConnections: elasticstack.ElasticsearchMlJobStateElasticsearchConnectionArray{
    		&elasticstack.ElasticsearchMlJobStateElasticsearchConnectionArgs{
    			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"),
    		},
    	},
    	Force:      pulumi.Bool(false),
    	JobTimeout: pulumi.String("string"),
    	Timeouts: &elasticstack.ElasticsearchMlJobStateTimeoutsArgs{
    		Create: pulumi.String("string"),
    		Update: pulumi.String("string"),
    	},
    })
    
    resource "elasticstack_elasticsearchmljobstate" "elasticsearchMlJobStateResource" {
      job_id = "string"
      state  = "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"
      }
      force       = false
      job_timeout = "string"
      timeouts = {
        create = "string"
        update = "string"
      }
    }
    
    var elasticsearchMlJobStateResource = new ElasticsearchMlJobState("elasticsearchMlJobStateResource", ElasticsearchMlJobStateArgs.builder()
        .jobId("string")
        .state("string")
        .elasticsearchConnections(ElasticsearchMlJobStateElasticsearchConnectionArgs.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())
        .force(false)
        .jobTimeout("string")
        .timeouts(ElasticsearchMlJobStateTimeoutsArgs.builder()
            .create("string")
            .update("string")
            .build())
        .build());
    
    elasticsearch_ml_job_state_resource = elasticstack.ElasticsearchMlJobState("elasticsearchMlJobStateResource",
        job_id="string",
        state="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",
        }],
        force=False,
        job_timeout="string",
        timeouts={
            "create": "string",
            "update": "string",
        })
    
    const elasticsearchMlJobStateResource = new elasticstack.ElasticsearchMlJobState("elasticsearchMlJobStateResource", {
        jobId: "string",
        state: "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",
        }],
        force: false,
        jobTimeout: "string",
        timeouts: {
            create: "string",
            update: "string",
        },
    });
    
    type: elasticstack:ElasticsearchMlJobState
    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
        force: false
        jobId: string
        jobTimeout: string
        state: string
        timeouts:
            create: string
            update: string
    

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

    JobId string
    Identifier for the anomaly detection job.
    State string
    The desired state for the ML job. Valid values are opened and closed.
    ElasticsearchConnections List<ElasticsearchMlJobStateElasticsearchConnection>
    Elasticsearch connection configuration block.
    Force bool
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    JobTimeout string
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    Timeouts ElasticsearchMlJobStateTimeouts
    JobId string
    Identifier for the anomaly detection job.
    State string
    The desired state for the ML job. Valid values are opened and closed.
    ElasticsearchConnections []ElasticsearchMlJobStateElasticsearchConnectionArgs
    Elasticsearch connection configuration block.
    Force bool
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    JobTimeout string
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    Timeouts ElasticsearchMlJobStateTimeoutsArgs
    job_id string
    Identifier for the anomaly detection job.
    state string
    The desired state for the ML job. Valid values are opened and closed.
    elasticsearch_connections list(object)
    Elasticsearch connection configuration block.
    force bool
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    job_timeout string
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    timeouts object
    jobId String
    Identifier for the anomaly detection job.
    state String
    The desired state for the ML job. Valid values are opened and closed.
    elasticsearchConnections List<ElasticsearchMlJobStateElasticsearchConnection>
    Elasticsearch connection configuration block.
    force Boolean
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    jobTimeout String
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    timeouts ElasticsearchMlJobStateTimeouts
    jobId string
    Identifier for the anomaly detection job.
    state string
    The desired state for the ML job. Valid values are opened and closed.
    elasticsearchConnections ElasticsearchMlJobStateElasticsearchConnection[]
    Elasticsearch connection configuration block.
    force boolean
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    jobTimeout string
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    timeouts ElasticsearchMlJobStateTimeouts
    job_id str
    Identifier for the anomaly detection job.
    state str
    The desired state for the ML job. Valid values are opened and closed.
    elasticsearch_connections Sequence[ElasticsearchMlJobStateElasticsearchConnectionArgs]
    Elasticsearch connection configuration block.
    force bool
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    job_timeout str
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    timeouts ElasticsearchMlJobStateTimeoutsArgs
    jobId String
    Identifier for the anomaly detection job.
    state String
    The desired state for the ML job. Valid values are opened and closed.
    elasticsearchConnections List<Property Map>
    Elasticsearch connection configuration block.
    force Boolean
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    jobTimeout String
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    timeouts Property Map

    Outputs

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

    Get an existing ElasticsearchMlJobState 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?: ElasticsearchMlJobStateState, opts?: CustomResourceOptions): ElasticsearchMlJobState
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            elasticsearch_connections: Optional[Sequence[ElasticsearchMlJobStateElasticsearchConnectionArgs]] = None,
            force: Optional[bool] = None,
            job_id: Optional[str] = None,
            job_timeout: Optional[str] = None,
            state: Optional[str] = None,
            timeouts: Optional[ElasticsearchMlJobStateTimeoutsArgs] = None) -> ElasticsearchMlJobState
    func GetElasticsearchMlJobState(ctx *Context, name string, id IDInput, state *ElasticsearchMlJobStateState, opts ...ResourceOption) (*ElasticsearchMlJobState, error)
    public static ElasticsearchMlJobState Get(string name, Input<string> id, ElasticsearchMlJobStateState? state, CustomResourceOptions? opts = null)
    public static ElasticsearchMlJobState get(String name, Output<String> id, ElasticsearchMlJobStateState state, CustomResourceOptions options)
    resources:  _:    type: elasticstack:ElasticsearchMlJobState    get:      id: ${id}
    import {
      to = elasticstack_elasticsearchmljobstate.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<ElasticsearchMlJobStateElasticsearchConnection>
    Elasticsearch connection configuration block.
    Force bool
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    JobId string
    Identifier for the anomaly detection job.
    JobTimeout string
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    State string
    The desired state for the ML job. Valid values are opened and closed.
    Timeouts ElasticsearchMlJobStateTimeouts
    ElasticsearchConnections []ElasticsearchMlJobStateElasticsearchConnectionArgs
    Elasticsearch connection configuration block.
    Force bool
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    JobId string
    Identifier for the anomaly detection job.
    JobTimeout string
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    State string
    The desired state for the ML job. Valid values are opened and closed.
    Timeouts ElasticsearchMlJobStateTimeoutsArgs
    elasticsearch_connections list(object)
    Elasticsearch connection configuration block.
    force bool
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    job_id string
    Identifier for the anomaly detection job.
    job_timeout string
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    state string
    The desired state for the ML job. Valid values are opened and closed.
    timeouts object
    elasticsearchConnections List<ElasticsearchMlJobStateElasticsearchConnection>
    Elasticsearch connection configuration block.
    force Boolean
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    jobId String
    Identifier for the anomaly detection job.
    jobTimeout String
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    state String
    The desired state for the ML job. Valid values are opened and closed.
    timeouts ElasticsearchMlJobStateTimeouts
    elasticsearchConnections ElasticsearchMlJobStateElasticsearchConnection[]
    Elasticsearch connection configuration block.
    force boolean
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    jobId string
    Identifier for the anomaly detection job.
    jobTimeout string
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    state string
    The desired state for the ML job. Valid values are opened and closed.
    timeouts ElasticsearchMlJobStateTimeouts
    elasticsearch_connections Sequence[ElasticsearchMlJobStateElasticsearchConnectionArgs]
    Elasticsearch connection configuration block.
    force bool
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    job_id str
    Identifier for the anomaly detection job.
    job_timeout str
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    state str
    The desired state for the ML job. Valid values are opened and closed.
    timeouts ElasticsearchMlJobStateTimeoutsArgs
    elasticsearchConnections List<Property Map>
    Elasticsearch connection configuration block.
    force Boolean
    When closing a job, use to forcefully close it. This method is quicker but can miss important clean up tasks.
    jobId String
    Identifier for the anomaly detection job.
    jobTimeout String
    Timeout for the operation. Examples: 30s, 5m, 1h. Default is 30s.
    state String
    The desired state for the ML job. Valid values are opened and closed.
    timeouts Property Map

    Supporting Types

    ElasticsearchMlJobStateElasticsearchConnection, ElasticsearchMlJobStateElasticsearchConnectionArgs

    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.

    ElasticsearchMlJobStateTimeouts, ElasticsearchMlJobStateTimeoutsArgs

    Create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    update String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    update str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    update String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

    Import

    ant Notes

    • This resource manages the state of an existing ML job, not the job configuration itself.
    • The ML job must already exist before using this resource.
    • Opening a job allows it to receive and process data.
    • Closing a job stops data processing and frees up resources.
    • Jobs can be opened and closed multiple times throughout their lifecycle.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as elasticstack from "@pulumi/elasticstack";
    
    const forOpenExample = new elasticstack.ElasticsearchMlAnomalyDetectionJob("for_open_example", {
        jobId: "example-ml-job-open-example",
        description: "Example anomaly detection job",
        analysisConfig: {
            bucketSpan: "15m",
            detectors: [{
                "function": "count",
                detectorDescription: "Count detector",
            }],
        },
        dataDescription: {
            timeField: "@timestamp",
            timeFormat: "epoch_ms",
        },
    });
    const example = new elasticstack.ElasticsearchMlJobState("example", {
        jobId: forOpenExample.jobId,
        state: "opened",
        force: false,
        jobTimeout: "30s",
        timeouts: {
            create: "5m",
            update: "5m",
        },
    }, {
        dependsOn: [forOpenExample],
    });
    const forCloseExample = new elasticstack.ElasticsearchMlAnomalyDetectionJob("for_close_example", {
        jobId: "example-ml-job-close-example",
        description: "Example anomaly detection job for force-close illustration",
        analysisConfig: {
            bucketSpan: "15m",
            detectors: [{
                "function": "count",
                detectorDescription: "Count detector",
            }],
        },
        dataDescription: {
            timeField: "@timestamp",
            timeFormat: "epoch_ms",
        },
    });
    const exampleWithOptions = new elasticstack.ElasticsearchMlJobState("example_with_options", {
        jobId: forCloseExample.jobId,
        state: "closed",
        force: true,
        jobTimeout: "2m",
        timeouts: {
            create: "10m",
            update: "3m",
        },
    }, {
        dependsOn: [forCloseExample],
    });
    
    import pulumi
    import pulumi_elasticstack as elasticstack
    
    for_open_example = elasticstack.ElasticsearchMlAnomalyDetectionJob("for_open_example",
        job_id="example-ml-job-open-example",
        description="Example anomaly detection job",
        analysis_config={
            "bucket_span": "15m",
            "detectors": [{
                "function": "count",
                "detector_description": "Count detector",
            }],
        },
        data_description={
            "time_field": "@timestamp",
            "time_format": "epoch_ms",
        })
    example = elasticstack.ElasticsearchMlJobState("example",
        job_id=for_open_example.job_id,
        state="opened",
        force=False,
        job_timeout="30s",
        timeouts={
            "create": "5m",
            "update": "5m",
        },
        opts = pulumi.ResourceOptions(depends_on=[for_open_example]))
    for_close_example = elasticstack.ElasticsearchMlAnomalyDetectionJob("for_close_example",
        job_id="example-ml-job-close-example",
        description="Example anomaly detection job for force-close illustration",
        analysis_config={
            "bucket_span": "15m",
            "detectors": [{
                "function": "count",
                "detector_description": "Count detector",
            }],
        },
        data_description={
            "time_field": "@timestamp",
            "time_format": "epoch_ms",
        })
    example_with_options = elasticstack.ElasticsearchMlJobState("example_with_options",
        job_id=for_close_example.job_id,
        state="closed",
        force=True,
        job_timeout="2m",
        timeouts={
            "create": "10m",
            "update": "3m",
        },
        opts = pulumi.ResourceOptions(depends_on=[for_close_example]))
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Elasticstack = Pulumi.Elasticstack;
    
    return await Deployment.RunAsync(() => 
    {
        var forOpenExample = new Elasticstack.ElasticsearchMlAnomalyDetectionJob("for_open_example", new()
        {
            JobId = "example-ml-job-open-example",
            Description = "Example anomaly detection job",
            AnalysisConfig = new Elasticstack.Inputs.ElasticsearchMlAnomalyDetectionJobAnalysisConfigArgs
            {
                BucketSpan = "15m",
                Detectors = new[]
                {
                    new Elasticstack.Inputs.ElasticsearchMlAnomalyDetectionJobAnalysisConfigDetectorArgs
                    {
                        Function = "count",
                        DetectorDescription = "Count detector",
                    },
                },
            },
            DataDescription = new Elasticstack.Inputs.ElasticsearchMlAnomalyDetectionJobDataDescriptionArgs
            {
                TimeField = "@timestamp",
                TimeFormat = "epoch_ms",
            },
        });
    
        var example = new Elasticstack.ElasticsearchMlJobState("example", new()
        {
            JobId = forOpenExample.JobId,
            State = "opened",
            Force = false,
            JobTimeout = "30s",
            Timeouts = new Elasticstack.Inputs.ElasticsearchMlJobStateTimeoutsArgs
            {
                Create = "5m",
                Update = "5m",
            },
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                forOpenExample,
            },
        });
    
        var forCloseExample = new Elasticstack.ElasticsearchMlAnomalyDetectionJob("for_close_example", new()
        {
            JobId = "example-ml-job-close-example",
            Description = "Example anomaly detection job for force-close illustration",
            AnalysisConfig = new Elasticstack.Inputs.ElasticsearchMlAnomalyDetectionJobAnalysisConfigArgs
            {
                BucketSpan = "15m",
                Detectors = new[]
                {
                    new Elasticstack.Inputs.ElasticsearchMlAnomalyDetectionJobAnalysisConfigDetectorArgs
                    {
                        Function = "count",
                        DetectorDescription = "Count detector",
                    },
                },
            },
            DataDescription = new Elasticstack.Inputs.ElasticsearchMlAnomalyDetectionJobDataDescriptionArgs
            {
                TimeField = "@timestamp",
                TimeFormat = "epoch_ms",
            },
        });
    
        var exampleWithOptions = new Elasticstack.ElasticsearchMlJobState("example_with_options", new()
        {
            JobId = forCloseExample.JobId,
            State = "closed",
            Force = true,
            JobTimeout = "2m",
            Timeouts = new Elasticstack.Inputs.ElasticsearchMlJobStateTimeoutsArgs
            {
                Create = "10m",
                Update = "3m",
            },
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                forCloseExample,
            },
        });
    
    });
    
    package main
    
    import (
    	"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 {
    		forOpenExample, err := elasticstack.NewElasticsearchMlAnomalyDetectionJob(ctx, "for_open_example", &elasticstack.ElasticsearchMlAnomalyDetectionJobArgs{
    			JobId:       pulumi.String("example-ml-job-open-example"),
    			Description: pulumi.String("Example anomaly detection job"),
    			AnalysisConfig: &elasticstack.ElasticsearchMlAnomalyDetectionJobAnalysisConfigArgs{
    				BucketSpan: pulumi.String("15m"),
    				Detectors: elasticstack.ElasticsearchMlAnomalyDetectionJobAnalysisConfigDetectorArray{
    					&elasticstack.ElasticsearchMlAnomalyDetectionJobAnalysisConfigDetectorArgs{
    						Function:            pulumi.String("count"),
    						DetectorDescription: pulumi.String("Count detector"),
    					},
    				},
    			},
    			DataDescription: &elasticstack.ElasticsearchMlAnomalyDetectionJobDataDescriptionArgs{
    				TimeField:  pulumi.String("@timestamp"),
    				TimeFormat: pulumi.String("epoch_ms"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = elasticstack.NewElasticsearchMlJobState(ctx, "example", &elasticstack.ElasticsearchMlJobStateArgs{
    			JobId:      forOpenExample.JobId,
    			State:      pulumi.String("opened"),
    			Force:      pulumi.Bool(false),
    			JobTimeout: pulumi.String("30s"),
    			Timeouts: &elasticstack.ElasticsearchMlJobStateTimeoutsArgs{
    				Create: pulumi.String("5m"),
    				Update: pulumi.String("5m"),
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			forOpenExample,
    		}))
    		if err != nil {
    			return err
    		}
    		forCloseExample, err := elasticstack.NewElasticsearchMlAnomalyDetectionJob(ctx, "for_close_example", &elasticstack.ElasticsearchMlAnomalyDetectionJobArgs{
    			JobId:       pulumi.String("example-ml-job-close-example"),
    			Description: pulumi.String("Example anomaly detection job for force-close illustration"),
    			AnalysisConfig: &elasticstack.ElasticsearchMlAnomalyDetectionJobAnalysisConfigArgs{
    				BucketSpan: pulumi.String("15m"),
    				Detectors: elasticstack.ElasticsearchMlAnomalyDetectionJobAnalysisConfigDetectorArray{
    					&elasticstack.ElasticsearchMlAnomalyDetectionJobAnalysisConfigDetectorArgs{
    						Function:            pulumi.String("count"),
    						DetectorDescription: pulumi.String("Count detector"),
    					},
    				},
    			},
    			DataDescription: &elasticstack.ElasticsearchMlAnomalyDetectionJobDataDescriptionArgs{
    				TimeField:  pulumi.String("@timestamp"),
    				TimeFormat: pulumi.String("epoch_ms"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = elasticstack.NewElasticsearchMlJobState(ctx, "example_with_options", &elasticstack.ElasticsearchMlJobStateArgs{
    			JobId:      forCloseExample.JobId,
    			State:      pulumi.String("closed"),
    			Force:      pulumi.Bool(true),
    			JobTimeout: pulumi.String("2m"),
    			Timeouts: &elasticstack.ElasticsearchMlJobStateTimeoutsArgs{
    				Create: pulumi.String("10m"),
    				Update: pulumi.String("3m"),
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			forCloseExample,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.elasticstack.ElasticsearchMlAnomalyDetectionJob;
    import com.pulumi.elasticstack.ElasticsearchMlAnomalyDetectionJobArgs;
    import com.pulumi.elasticstack.inputs.ElasticsearchMlAnomalyDetectionJobAnalysisConfigArgs;
    import com.pulumi.elasticstack.inputs.ElasticsearchMlAnomalyDetectionJobDataDescriptionArgs;
    import com.pulumi.elasticstack.ElasticsearchMlJobState;
    import com.pulumi.elasticstack.ElasticsearchMlJobStateArgs;
    import com.pulumi.elasticstack.inputs.ElasticsearchMlJobStateTimeoutsArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 forOpenExample = new ElasticsearchMlAnomalyDetectionJob("forOpenExample", ElasticsearchMlAnomalyDetectionJobArgs.builder()
                .jobId("example-ml-job-open-example")
                .description("Example anomaly detection job")
                .analysisConfig(ElasticsearchMlAnomalyDetectionJobAnalysisConfigArgs.builder()
                    .bucketSpan("15m")
                    .detectors(ElasticsearchMlAnomalyDetectionJobAnalysisConfigDetectorArgs.builder()
                        .function("count")
                        .detectorDescription("Count detector")
                        .build())
                    .build())
                .dataDescription(ElasticsearchMlAnomalyDetectionJobDataDescriptionArgs.builder()
                    .timeField("@timestamp")
                    .timeFormat("epoch_ms")
                    .build())
                .build());
    
            var example = new ElasticsearchMlJobState("example", ElasticsearchMlJobStateArgs.builder()
                .jobId(forOpenExample.jobId())
                .state("opened")
                .force(false)
                .jobTimeout("30s")
                .timeouts(ElasticsearchMlJobStateTimeoutsArgs.builder()
                    .create("5m")
                    .update("5m")
                    .build())
                .build(), CustomResourceOptions.builder()
                    .dependsOn(forOpenExample)
                    .build());
    
            var forCloseExample = new ElasticsearchMlAnomalyDetectionJob("forCloseExample", ElasticsearchMlAnomalyDetectionJobArgs.builder()
                .jobId("example-ml-job-close-example")
                .description("Example anomaly detection job for force-close illustration")
                .analysisConfig(ElasticsearchMlAnomalyDetectionJobAnalysisConfigArgs.builder()
                    .bucketSpan("15m")
                    .detectors(ElasticsearchMlAnomalyDetectionJobAnalysisConfigDetectorArgs.builder()
                        .function("count")
                        .detectorDescription("Count detector")
                        .build())
                    .build())
                .dataDescription(ElasticsearchMlAnomalyDetectionJobDataDescriptionArgs.builder()
                    .timeField("@timestamp")
                    .timeFormat("epoch_ms")
                    .build())
                .build());
    
            var exampleWithOptions = new ElasticsearchMlJobState("exampleWithOptions", ElasticsearchMlJobStateArgs.builder()
                .jobId(forCloseExample.jobId())
                .state("closed")
                .force(true)
                .jobTimeout("2m")
                .timeouts(ElasticsearchMlJobStateTimeoutsArgs.builder()
                    .create("10m")
                    .update("3m")
                    .build())
                .build(), CustomResourceOptions.builder()
                    .dependsOn(forCloseExample)
                    .build());
    
        }
    }
    
    resources:
      forOpenExample:
        type: elasticstack:ElasticsearchMlAnomalyDetectionJob
        name: for_open_example
        properties:
          jobId: example-ml-job-open-example
          description: Example anomaly detection job
          analysisConfig:
            bucketSpan: 15m
            detectors:
              - function: count
                detectorDescription: Count detector
          dataDescription:
            timeField: '@timestamp'
            timeFormat: epoch_ms
      example:
        type: elasticstack:ElasticsearchMlJobState
        properties:
          jobId: ${forOpenExample.jobId}
          state: opened
          force: false
          jobTimeout: 30s
          timeouts:
            create: 5m
            update: 5m
        options:
          dependsOn:
            - ${forOpenExample}
      forCloseExample:
        type: elasticstack:ElasticsearchMlAnomalyDetectionJob
        name: for_close_example
        properties:
          jobId: example-ml-job-close-example
          description: Example anomaly detection job for force-close illustration
          analysisConfig:
            bucketSpan: 15m
            detectors:
              - function: count
                detectorDescription: Count detector
          dataDescription:
            timeField: '@timestamp'
            timeFormat: epoch_ms
      exampleWithOptions:
        type: elasticstack:ElasticsearchMlJobState
        name: example_with_options
        properties:
          jobId: ${forCloseExample.jobId}
          state: closed
          force: true
          jobTimeout: 2m
          timeouts:
            create: 10m
            update: 3m
        options:
          dependsOn:
            - ${forCloseExample}
    

    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.15.0
    published on Thursday, May 14, 2026 by elastic
      Try Pulumi Cloud free. Your team will thank you.