AiIndex

class AiIndex : KotlinCustomResource

A representation of a collection of database items organized in a way that allows for approximate nearest neighbor (a.k.a ANN) algorithms search. To get more information about Index, see:

Example Usage

Vertex Ai Index

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.storage.BucketObject;
import com.pulumi.gcp.storage.BucketObjectArgs;
import com.pulumi.gcp.vertex.AiIndex;
import com.pulumi.gcp.vertex.AiIndexArgs;
import com.pulumi.gcp.vertex.inputs.AiIndexMetadataArgs;
import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigArgs;
import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigAlgorithmConfigArgs;
import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigAlgorithmConfigTreeAhConfigArgs;
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 bucket = new Bucket("bucket", BucketArgs.builder()
.location("us-central1")
.uniformBucketLevelAccess(true)
.build());
var data = new BucketObject("data", BucketObjectArgs.builder()
.bucket(bucket.name())
.content("""
{"id": "42", "embedding": [0.5, 1.0], "restricts": [{"namespace": "class", "allow": ["cat", "pet"]},{"namespace": "category", "allow": ["feline"]}]}
{"id": "43", "embedding": [0.6, 1.0], "restricts": [{"namespace": "class", "allow": ["dog", "pet"]},{"namespace": "category", "allow": ["canine"]}]}
""")
.build());
var index = new AiIndex("index", AiIndexArgs.builder()
.labels(Map.of("foo", "bar"))
.region("us-central1")
.displayName("test-index")
.description("index for test")
.metadata(AiIndexMetadataArgs.builder()
.contentsDeltaUri(bucket.name().applyValue(name -> String.format("gs://%s/contents", name)))
.config(AiIndexMetadataConfigArgs.builder()
.dimensions(2)
.approximateNeighborsCount(150)
.shardSize("SHARD_SIZE_SMALL")
.distanceMeasureType("DOT_PRODUCT_DISTANCE")
.algorithmConfig(AiIndexMetadataConfigAlgorithmConfigArgs.builder()
.treeAhConfig(AiIndexMetadataConfigAlgorithmConfigTreeAhConfigArgs.builder()
.leafNodeEmbeddingCount(500)
.leafNodesToSearchPercent(7)
.build())
.build())
.build())
.build())
.indexUpdateMethod("BATCH_UPDATE")
.build());
}
}

Vertex Ai Index Streaming

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.storage.BucketObject;
import com.pulumi.gcp.storage.BucketObjectArgs;
import com.pulumi.gcp.vertex.AiIndex;
import com.pulumi.gcp.vertex.AiIndexArgs;
import com.pulumi.gcp.vertex.inputs.AiIndexMetadataArgs;
import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigArgs;
import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigAlgorithmConfigArgs;
import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigAlgorithmConfigBruteForceConfigArgs;
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 bucket = new Bucket("bucket", BucketArgs.builder()
.location("us-central1")
.uniformBucketLevelAccess(true)
.build());
var data = new BucketObject("data", BucketObjectArgs.builder()
.bucket(bucket.name())
.content("""
{"id": "42", "embedding": [0.5, 1.0], "restricts": [{"namespace": "class", "allow": ["cat", "pet"]},{"namespace": "category", "allow": ["feline"]}]}
{"id": "43", "embedding": [0.6, 1.0], "restricts": [{"namespace": "class", "allow": ["dog", "pet"]},{"namespace": "category", "allow": ["canine"]}]}
""")
.build());
var index = new AiIndex("index", AiIndexArgs.builder()
.labels(Map.of("foo", "bar"))
.region("us-central1")
.displayName("test-index")
.description("index for test")
.metadata(AiIndexMetadataArgs.builder()
.contentsDeltaUri(bucket.name().applyValue(name -> String.format("gs://%s/contents", name)))
.config(AiIndexMetadataConfigArgs.builder()
.dimensions(2)
.shardSize("SHARD_SIZE_LARGE")
.distanceMeasureType("COSINE_DISTANCE")
.featureNormType("UNIT_L2_NORM")
.algorithmConfig(AiIndexMetadataConfigAlgorithmConfigArgs.builder()
.bruteForceConfig()
.build())
.build())
.build())
.indexUpdateMethod("STREAM_UPDATE")
.build());
}
}

Import

Index can be imported using any of these accepted formats

$ pulumi import gcp:vertex/aiIndex:AiIndex default projects/{{project}}/locations/{{region}}/indexes/{{name}}
$ pulumi import gcp:vertex/aiIndex:AiIndex default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:vertex/aiIndex:AiIndex default {{region}}/{{name}}
$ pulumi import gcp:vertex/aiIndex:AiIndex default {{name}}

Properties

Link copied to clipboard
val createTime: Output<String>

The timestamp of when the Index was created in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.

Link copied to clipboard

The pointers to DeployedIndexes created from this Index. An Index can be only deleted if all its DeployedIndexes had been undeployed first. Structure is documented below.

Link copied to clipboard
val description: Output<String>?

The description of the Index.

Link copied to clipboard
val displayName: Output<String>

The display name of the Index. The name can be up to 128 characters long and can consist of any UTF-8 characters.

Link copied to clipboard
val etag: Output<String>

Used to perform consistent read-modify-write updates.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Stats of the index resource. Structure is documented below.

Link copied to clipboard

The update method to use with this Index. The value must be the followings. If not set, BATCH_UPDATE will be used by default.

Link copied to clipboard
val labels: Output<Map<String, String>>?

The labels with user-defined metadata to organize your Indexes.

Link copied to clipboard

An additional information about the Index Structure is documented below.

Link copied to clipboard

Points to a YAML file stored on Google Cloud Storage describing additional information about the Index, that is specific to it. Unset if the Index does not have any additional information.

Link copied to clipboard
val name: Output<String>

The resource name of the Index.

Link copied to clipboard
val project: Output<String>

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val region: Output<String>?

The region of the index. eg us-central1

Link copied to clipboard
val updateTime: Output<String>

The timestamp of when the Index was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.

Link copied to clipboard
val urn: Output<String>