// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "./types"; import * as utilities from "./utilities"; /** * Creates or updates an index. This resource can define settings, mappings and aliases. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as elasticstack from "@pulumi/elasticstack"; * * const myIndex = new elasticstack.ElasticsearchIndex("myIndex", { * aliases: [ * { * name: "my_alias_1", * }, * { * name: "my_alias_2", * filter: JSON.stringify({ * term: { * "user.id": "developer", * }, * }), * }, * ], * mappings: JSON.stringify({ * properties: { * field1: { * type: "keyword", * }, * field2: { * type: "text", * }, * field3: { * properties: { * inner_field1: { * type: "text", * index: false, * }, * inner_field2: { * type: "integer", * index: false, * }, * }, * }, * }, * }), * settings: { * settings: [ * { * name: "index.number_of_shards", * value: "1", * }, * { * name: "index.number_of_replicas", * value: "2", * }, * { * name: "index.search.idle.after", * value: "20s", * }, * ], * }, * }); * ``` * * ## Import * * You can later adjust the index configuration to account for those imported settings. Some of the default settings, which could be imported are`index.number_of_replicas`, `index.number_of_shards` and `index.routing.allocation.include._tier_preference`. # NOTEwhile importing index resource, keep in mind, that some of the default index settings will be imported into the TF state too # You can later adjust the index configuration to account for those imported settings * * ```sh * $ pulumi import elasticstack:index/elasticsearchIndex:ElasticsearchIndex my_index / * ``` */ export class ElasticsearchIndex extends pulumi.CustomResource { /** * Get an existing ElasticsearchIndex resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ public static get(name: string, id: pulumi.Input, state?: ElasticsearchIndexState, opts?: pulumi.CustomResourceOptions): ElasticsearchIndex { return new ElasticsearchIndex(name, state, { ...opts, id: id }); } /** @internal */ public static readonly __pulumiType = 'elasticstack:index/elasticsearchIndex:ElasticsearchIndex'; /** * Returns true if the given object is an instance of ElasticsearchIndex. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ public static isInstance(obj: any): obj is ElasticsearchIndex { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === ElasticsearchIndex.__pulumiType; } /** * Aliases for the index. */ public readonly aliases!: pulumi.Output; /** * Used to establish connection to Elasticsearch server. Overrides environment variables if present. */ public readonly elasticsearchConnection!: pulumi.Output; /** * Internal identifier of the resource */ public /*out*/ readonly id!: pulumi.Output; /** * Mapping for fields in the index. * If specified, this mapping can include: field names, field data types (https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html), mapping parameters (https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-params.html). * **NOTE:** changing datatypes in the existing *mappings* will force index to be re-created. */ public readonly mappings!: pulumi.Output; /** * Name of the index you wish to create. */ public readonly name!: pulumi.Output; /** * Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings. * **NOTE:** Static index settings (see: https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#*static*index_settings) can be only set on the index creation and later cannot be removed or updated - *apply* will return error */ public readonly settings!: pulumi.Output; /** * All raw settings fetched from the cluster. */ public /*out*/ readonly settingsRaw!: pulumi.Output; /** * Create a ElasticsearchIndex resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: ElasticsearchIndexArgs, opts?: pulumi.CustomResourceOptions) constructor(name: string, argsOrState?: ElasticsearchIndexArgs | ElasticsearchIndexState, opts?: pulumi.CustomResourceOptions) { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState as ElasticsearchIndexState | undefined; resourceInputs["aliases"] = state ? state.aliases : undefined; resourceInputs["elasticsearchConnection"] = state ? state.elasticsearchConnection : undefined; resourceInputs["id"] = state ? state.id : undefined; resourceInputs["mappings"] = state ? state.mappings : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["settings"] = state ? state.settings : undefined; resourceInputs["settingsRaw"] = state ? state.settingsRaw : undefined; } else { const args = argsOrState as ElasticsearchIndexArgs | undefined; resourceInputs["aliases"] = args ? args.aliases : undefined; resourceInputs["elasticsearchConnection"] = args ? args.elasticsearchConnection : undefined; resourceInputs["mappings"] = args ? args.mappings : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["settings"] = args ? args.settings : undefined; resourceInputs["id"] = undefined /*out*/; resourceInputs["settingsRaw"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ElasticsearchIndex.__pulumiType, name, resourceInputs, opts); } } /** * Input properties used for looking up and filtering ElasticsearchIndex resources. */ export interface ElasticsearchIndexState { /** * Aliases for the index. */ aliases?: pulumi.Input[]>; /** * Used to establish connection to Elasticsearch server. Overrides environment variables if present. */ elasticsearchConnection?: pulumi.Input; /** * Internal identifier of the resource */ id?: pulumi.Input; /** * Mapping for fields in the index. * If specified, this mapping can include: field names, field data types (https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html), mapping parameters (https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-params.html). * **NOTE:** changing datatypes in the existing *mappings* will force index to be re-created. */ mappings?: pulumi.Input; /** * Name of the index you wish to create. */ name?: pulumi.Input; /** * Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings. * **NOTE:** Static index settings (see: https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#*static*index_settings) can be only set on the index creation and later cannot be removed or updated - *apply* will return error */ settings?: pulumi.Input; /** * All raw settings fetched from the cluster. */ settingsRaw?: pulumi.Input; } /** * The set of arguments for constructing a ElasticsearchIndex resource. */ export interface ElasticsearchIndexArgs { /** * Aliases for the index. */ aliases?: pulumi.Input[]>; /** * Used to establish connection to Elasticsearch server. Overrides environment variables if present. */ elasticsearchConnection?: pulumi.Input; /** * Mapping for fields in the index. * If specified, this mapping can include: field names, field data types (https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html), mapping parameters (https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-params.html). * **NOTE:** changing datatypes in the existing *mappings* will force index to be re-created. */ mappings?: pulumi.Input; /** * Name of the index you wish to create. */ name?: pulumi.Input; /** * Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings. * **NOTE:** Static index settings (see: https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#*static*index_settings) can be only set on the index creation and later cannot be removed or updated - *apply* will return error */ settings?: pulumi.Input; }