IndexArgs

data class IndexArgs(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 with type set to "FIRESTORE_NATIVE" 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());
}
}

Import

Index can be imported using any of these accepted formats:

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

Constructors

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

Properties

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.

Functions

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