UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

472 lines • 18.8 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * An Index defines an approximate nearest-neighbor search structure over a * field of a Vector Search Collection. * * ## Example Usage * * ### Vectorsearch Index Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // NOTE: For most workloads we recommend creating the Collection and the Index * // in *separate* Terraform configurations (i.e. create and apply the Collection * // first, ingest data via importDataObjects, and only then create the Index in a * // second configuration). Once an Index exists on a Collection you can no longer * // run importDataObjects for bulk ingestion of data objects on that Collection -- * // you are limited to creating data objects one at a time or in small online * // batches. Defining both resources in the same Terraform file (as shown below) * // is convenient for a quick start, but locks you into the online / batched * // create path for any subsequent data ingestion. * const parent = new gcp.vectorsearch.Collection("parent", { * location: "us-central1", * collectionId: "example-collection", * displayName: "My Awesome Collection", * description: "This collection stores important data.", * dataSchema: `{ * \\"type\\": \\"object\\", * \\"properties\\": { * \\"title\\": { * \\"type\\": \\"string\\" * }, * \\"plot\\": { * \\"type\\": \\"string\\" * } * } * } * `, * vectorSchemas: [{ * fieldName: "text_embedding", * denseVector: { * dimensions: 768, * vertexEmbeddingConfig: { * modelId: "textembedding-gecko@003", * taskType: "RETRIEVAL_DOCUMENT", * textTemplate: "Title: {title} ---- Plot: {plot}", * }, * }, * }], * }); * const example_index = new gcp.vectorsearch.Index("example-index", { * location: "us-central1", * collectionId: parent.collectionId, * indexId: "example-index", * displayName: "My Awesome Index", * description: "ScaNN index over text_embedding.", * indexField: "text_embedding", * distanceMetric: "DOT_PRODUCT", * denseScann: { * featureNormType: "UNIT_L2_NORM", * }, * }); * ``` * ### Vectorsearch Index Dedicated * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // NOTE: For most workloads we recommend creating the Collection and the Index * // in *separate* Terraform configurations (i.e. create and apply the Collection * // first, ingest data via importDataObjects, and only then create the Index in a * // second configuration). Once an Index exists on a Collection you can no longer * // run importDataObjects for bulk ingestion of data objects on that Collection -- * // you are limited to creating data objects one at a time or in small online * // batches. Defining both resources in the same Terraform file (as shown below) * // is convenient for a quick start, but locks you into the online / batched * // create path for any subsequent data ingestion. * const parent = new gcp.vectorsearch.Collection("parent", { * location: "us-central1", * collectionId: "example-dedicated-collection", * displayName: "My Awesome Collection", * description: "Parent collection for a dedicated-infrastructure index.", * dataSchema: `{ * \\"type\\": \\"object\\", * \\"properties\\": { * \\"title\\": { * \\"type\\": \\"string\\" * }, * \\"category\\": { * \\"type\\": \\"string\\" * } * } * } * `, * vectorSchemas: [{ * fieldName: "text_embedding", * denseVector: { * dimensions: 768, * vertexEmbeddingConfig: { * modelId: "textembedding-gecko@003", * taskType: "RETRIEVAL_DOCUMENT", * textTemplate: "Title: {title}", * }, * }, * }], * }); * const example_dedicated_index = new gcp.vectorsearch.Index("example-dedicated-index", { * location: "us-central1", * collectionId: parent.collectionId, * indexId: "example-dedicated-index", * displayName: "My Dedicated Index", * description: "Index served on dedicated infrastructure with autoscaling.", * indexField: "text_embedding", * distanceMetric: "COSINE_DISTANCE", * filterFields: ["category"], * storeFields: ["title"], * denseScann: { * featureNormType: "UNIT_L2_NORM", * }, * dedicatedInfrastructure: { * mode: "PERFORMANCE_OPTIMIZED", * autoscalingSpec: { * minReplicaCount: 2, * maxReplicaCount: 5, * }, * }, * }); * ``` * * ## Import * * Index can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/indexes/{{index_id}}` * * `{{project}}/{{location}}/{{collection_id}}/{{index_id}}` * * `{{location}}/{{collection_id}}/{{index_id}}` * * When using the `pulumi import` command, Index can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:vectorsearch/index:Index default projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/indexes/{{index_id}} * $ pulumi import gcp:vectorsearch/index:Index default {{project}}/{{location}}/{{collection_id}}/{{index_id}} * $ pulumi import gcp:vectorsearch/index:Index default {{location}}/{{collection_id}}/{{index_id}} * ``` */ export declare class Index extends pulumi.CustomResource { /** * Get an existing Index 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. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: IndexState, opts?: pulumi.CustomResourceOptions): Index; /** * Returns true if the given object is an instance of Index. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Index; /** * The ID of the parent Collection. */ readonly collectionId: pulumi.Output<string>; /** * [Output only] Create time stamp */ readonly createTime: pulumi.Output<string>; /** * Dedicated infrastructure for the index. This field belongs to the * `infraType` oneof; if omitted, the server populates it with the * default `PERFORMANCE_OPTIMIZED` mode and an autoscaling spec of * `min_replica_count=2`, `max_replica_count=2`. * Structure is documented below. */ readonly dedicatedInfrastructure: pulumi.Output<outputs.vectorsearch.IndexDedicatedInfrastructure>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ readonly deletionPolicy: pulumi.Output<string>; /** * Dense ScaNN index configuration. This field belongs to the * `indexType` oneof; if omitted, the server populates it with default * ScaNN settings. * Structure is documented below. */ readonly denseScann: pulumi.Output<outputs.vectorsearch.IndexDenseScann>; /** * User-specified description of the index */ readonly description: pulumi.Output<string | undefined>; /** * User-specified display name of the index */ readonly displayName: pulumi.Output<string | undefined>; /** * Distance metric used for indexing. If not specified, will default to * `DOT_PRODUCT`. * Possible values are: `DOT_PRODUCT`, `COSINE_DISTANCE`. */ readonly distanceMetric: pulumi.Output<string>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * The fields to push into the index to enable fast ANN inline filtering. */ readonly filterFields: pulumi.Output<string[] | undefined>; /** * The collection schema field to index. */ readonly indexField: pulumi.Output<string>; /** * ID of the Index to create. * The id must be 1-63 characters long, and comply with * [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). * Specifically, it must be 1-63 characters long and match the regular * expression `a-z?`. */ readonly indexId: pulumi.Output<string>; /** * Labels as key value pairs. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ readonly location: pulumi.Output<string>; /** * Identifier. name of resource */ readonly name: pulumi.Output<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * The fields to push into the index to enable inline data retrieval. */ readonly storeFields: pulumi.Output<string[] | undefined>; /** * [Output only] Update time stamp */ readonly updateTime: pulumi.Output<string>; /** * Create a Index 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: IndexArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Index resources. */ export interface IndexState { /** * The ID of the parent Collection. */ collectionId?: pulumi.Input<string | undefined>; /** * [Output only] Create time stamp */ createTime?: pulumi.Input<string | undefined>; /** * Dedicated infrastructure for the index. This field belongs to the * `infraType` oneof; if omitted, the server populates it with the * default `PERFORMANCE_OPTIMIZED` mode and an autoscaling spec of * `min_replica_count=2`, `max_replica_count=2`. * Structure is documented below. */ dedicatedInfrastructure?: pulumi.Input<inputs.vectorsearch.IndexDedicatedInfrastructure | undefined>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ deletionPolicy?: pulumi.Input<string | undefined>; /** * Dense ScaNN index configuration. This field belongs to the * `indexType` oneof; if omitted, the server populates it with default * ScaNN settings. * Structure is documented below. */ denseScann?: pulumi.Input<inputs.vectorsearch.IndexDenseScann | undefined>; /** * User-specified description of the index */ description?: pulumi.Input<string | undefined>; /** * User-specified display name of the index */ displayName?: pulumi.Input<string | undefined>; /** * Distance metric used for indexing. If not specified, will default to * `DOT_PRODUCT`. * Possible values are: `DOT_PRODUCT`, `COSINE_DISTANCE`. */ distanceMetric?: pulumi.Input<string | undefined>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; } | undefined>; /** * The fields to push into the index to enable fast ANN inline filtering. */ filterFields?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The collection schema field to index. */ indexField?: pulumi.Input<string | undefined>; /** * ID of the Index to create. * The id must be 1-63 characters long, and comply with * [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). * Specifically, it must be 1-63 characters long and match the regular * expression `a-z?`. */ indexId?: pulumi.Input<string | undefined>; /** * Labels as key value pairs. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; } | undefined>; /** * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ location?: pulumi.Input<string | undefined>; /** * Identifier. name of resource */ name?: pulumi.Input<string | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string | undefined>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; } | undefined>; /** * The fields to push into the index to enable inline data retrieval. */ storeFields?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * [Output only] Update time stamp */ updateTime?: pulumi.Input<string | undefined>; } /** * The set of arguments for constructing a Index resource. */ export interface IndexArgs { /** * The ID of the parent Collection. */ collectionId: pulumi.Input<string>; /** * Dedicated infrastructure for the index. This field belongs to the * `infraType` oneof; if omitted, the server populates it with the * default `PERFORMANCE_OPTIMIZED` mode and an autoscaling spec of * `min_replica_count=2`, `max_replica_count=2`. * Structure is documented below. */ dedicatedInfrastructure?: pulumi.Input<inputs.vectorsearch.IndexDedicatedInfrastructure | undefined>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ deletionPolicy?: pulumi.Input<string | undefined>; /** * Dense ScaNN index configuration. This field belongs to the * `indexType` oneof; if omitted, the server populates it with default * ScaNN settings. * Structure is documented below. */ denseScann?: pulumi.Input<inputs.vectorsearch.IndexDenseScann | undefined>; /** * User-specified description of the index */ description?: pulumi.Input<string | undefined>; /** * User-specified display name of the index */ displayName?: pulumi.Input<string | undefined>; /** * Distance metric used for indexing. If not specified, will default to * `DOT_PRODUCT`. * Possible values are: `DOT_PRODUCT`, `COSINE_DISTANCE`. */ distanceMetric?: pulumi.Input<string | undefined>; /** * The fields to push into the index to enable fast ANN inline filtering. */ filterFields?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The collection schema field to index. */ indexField: pulumi.Input<string>; /** * ID of the Index to create. * The id must be 1-63 characters long, and comply with * [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). * Specifically, it must be 1-63 characters long and match the regular * expression `a-z?`. */ indexId: pulumi.Input<string>; /** * Labels as key value pairs. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; } | undefined>; /** * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ location: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string | undefined>; /** * The fields to push into the index to enable inline data retrieval. */ storeFields?: pulumi.Input<pulumi.Input<string>[] | undefined>; } //# sourceMappingURL=index_.d.ts.map