IndexArgs

data class IndexArgs(val apiScope: Output<String>? = null, val collection: Output<String>? = null, val database: Output<String>? = null, val fields: Output<List<IndexFieldArgs>>? = null, val project: Output<String>? = null, val queryScope: Output<String>? = null) : ConvertibleToJava<IndexArgs>

Cloud Firestore indexes enable simple and complex queries against documents in a database. This resource manages composite indexes and not single field indexes. To get more information about Index, see:

Warning: This resource creates a Firestore Index on a project that already has a Firestore database. If you haven't already created it, you may create a gcp.firestore.Database resource and location_id set to your chosen location. If you wish to use App Engine, you may instead create a gcp.appengine.Application resource with database_type set to "CLOUD_FIRESTORE". Your Firestore location will be the same as the App Engine location specified.

Example Usage

Firestore Index Basic

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
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 my_index = new Index("my-index", IndexArgs.builder()
.collection("chatrooms")
.fields(
IndexFieldArgs.builder()
.fieldPath("name")
.order("ASCENDING")
.build(),
IndexFieldArgs.builder()
.fieldPath("description")
.order("DESCENDING")
.build())
.project("my-project-name")
.build());
}
}

Firestore Index Datastore Mode

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
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 my_datastore_mode_index = new Index("my-datastore-mode-index", IndexArgs.builder()
.apiScope("DATASTORE_MODE_API")
.collection("chatrooms")
.fields(
IndexFieldArgs.builder()
.fieldPath("name")
.order("ASCENDING")
.build(),
IndexFieldArgs.builder()
.fieldPath("description")
.order("DESCENDING")
.build())
.project("my-project-name")
.queryScope("COLLECTION_RECURSIVE")
.build());
}
}

Import

Index can be imported using any of these accepted formats* {{name}} In Terraform v1.5.0 and later, use an import block to import Index using one of the formats above. For exampletf import { id = "{{name}}" to = google_firestore_index.default }

$ pulumi import gcp:firestore/index:Index When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Index can be imported using one of the formats above. For example
$ pulumi import gcp:firestore/index:Index default {{name}}

Constructors

Link copied to clipboard
fun IndexArgs(apiScope: Output<String>? = null, collection: Output<String>? = null, database: Output<String>? = null, fields: Output<List<IndexFieldArgs>>? = null, project: Output<String>? = null, queryScope: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): IndexArgs

Properties

Link copied to clipboard
val apiScope: Output<String>? = null

The API scope at which a query is run. Default value is ANY_API. Possible values are: ANY_API, DATASTORE_MODE_API.

Link copied to clipboard
val collection: Output<String>? = null

The collection being indexed.

Link copied to clipboard
val database: Output<String>? = null

The Firestore database id. Defaults to "(default)".

Link copied to clipboard
val fields: Output<List<IndexFieldArgs>>? = null

The fields supported by this index. The last field entry is always for the field path __name__. If, on creation, __name__ was not specified as the last field, it will be added automatically with the same direction as that of the last field defined. If the final field in a composite index is not directional, the __name__ will be ordered "ASCENDING" (unless explicitly specified otherwise). Structure is documented below.

Link copied to clipboard
val project: Output<String>? = null

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 queryScope: Output<String>? = null

The scope at which a query is run. Default value is COLLECTION. Possible values are: COLLECTION, COLLECTION_GROUP, COLLECTION_RECURSIVE.