Index Args
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:
How-to Guides
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 withtype
set to"FIRESTORE_NATIVE"
andlocation_id
set to your chosen location. If you wish to use App Engine, you may instead create agcp.appengine.Application
resource withdatabase_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
Properties
The collection being indexed.
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.
The scope at which a query is run. Default value is COLLECTION
. Possible values are: COLLECTION
, COLLECTION_GROUP
.