Index

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 Firestore enabled. If you haven't already enabled it, you can create a gcp.appengine.Application resource with database_type set to "CLOUD_FIRESTORE" to do so. 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());
}
}

Import

Index can be imported using any of these accepted formats

$ pulumi import gcp:firestore/index:Index default {{name}}

Properties

Link copied to clipboard
val collection: Output<String>

The collection being indexed.

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

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

Link copied to clipboard
val fields: Output<List<IndexField>>

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 id: Output<String>
Link copied to clipboard
val name: Output<String>

A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}

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
Link copied to clipboard
Link copied to clipboard
val queryScope: Output<String>?

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

Link copied to clipboard
val urn: Output<String>