1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. firestore
  5. Index
Google Cloud Classic v8.5.0 published on Tuesday, Oct 8, 2024 by Pulumi

gcp.firestore.Index

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.5.0 published on Tuesday, Oct 8, 2024 by Pulumi

    Cloud Firestore indexes enable simple and complex queries against documents in a database. Both Firestore Native and Datastore Mode indexes are supported. This resource manages composite indexes and not single field indexes. To manage single field indexes, use the gcp.firestore.Field resource instead.

    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. Your Firestore location will be the same as the App Engine location specified.

    Example Usage

    Firestore Index Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const database = new gcp.firestore.Database("database", {
        project: "my-project-name",
        name: "database-id",
        locationId: "nam5",
        type: "FIRESTORE_NATIVE",
        deleteProtectionState: "DELETE_PROTECTION_DISABLED",
        deletionPolicy: "DELETE",
    });
    const my_index = new gcp.firestore.Index("my-index", {
        project: "my-project-name",
        database: database.name,
        collection: "atestcollection",
        fields: [
            {
                fieldPath: "name",
                order: "ASCENDING",
            },
            {
                fieldPath: "description",
                order: "DESCENDING",
            },
        ],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    database = gcp.firestore.Database("database",
        project="my-project-name",
        name="database-id",
        location_id="nam5",
        type="FIRESTORE_NATIVE",
        delete_protection_state="DELETE_PROTECTION_DISABLED",
        deletion_policy="DELETE")
    my_index = gcp.firestore.Index("my-index",
        project="my-project-name",
        database=database.name,
        collection="atestcollection",
        fields=[
            {
                "field_path": "name",
                "order": "ASCENDING",
            },
            {
                "field_path": "description",
                "order": "DESCENDING",
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/firestore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
    			Project:               pulumi.String("my-project-name"),
    			Name:                  pulumi.String("database-id"),
    			LocationId:            pulumi.String("nam5"),
    			Type:                  pulumi.String("FIRESTORE_NATIVE"),
    			DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
    			DeletionPolicy:        pulumi.String("DELETE"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
    			Project:    pulumi.String("my-project-name"),
    			Database:   database.Name,
    			Collection: pulumi.String("atestcollection"),
    			Fields: firestore.IndexFieldArray{
    				&firestore.IndexFieldArgs{
    					FieldPath: pulumi.String("name"),
    					Order:     pulumi.String("ASCENDING"),
    				},
    				&firestore.IndexFieldArgs{
    					FieldPath: pulumi.String("description"),
    					Order:     pulumi.String("DESCENDING"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var database = new Gcp.Firestore.Database("database", new()
        {
            Project = "my-project-name",
            Name = "database-id",
            LocationId = "nam5",
            Type = "FIRESTORE_NATIVE",
            DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
            DeletionPolicy = "DELETE",
        });
    
        var my_index = new Gcp.Firestore.Index("my-index", new()
        {
            Project = "my-project-name",
            Database = database.Name,
            Collection = "atestcollection",
            Fields = new[]
            {
                new Gcp.Firestore.Inputs.IndexFieldArgs
                {
                    FieldPath = "name",
                    Order = "ASCENDING",
                },
                new Gcp.Firestore.Inputs.IndexFieldArgs
                {
                    FieldPath = "description",
                    Order = "DESCENDING",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.firestore.Database;
    import com.pulumi.gcp.firestore.DatabaseArgs;
    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 database = new Database("database", DatabaseArgs.builder()
                .project("my-project-name")
                .name("database-id")
                .locationId("nam5")
                .type("FIRESTORE_NATIVE")
                .deleteProtectionState("DELETE_PROTECTION_DISABLED")
                .deletionPolicy("DELETE")
                .build());
    
            var my_index = new Index("my-index", IndexArgs.builder()
                .project("my-project-name")
                .database(database.name())
                .collection("atestcollection")
                .fields(            
                    IndexFieldArgs.builder()
                        .fieldPath("name")
                        .order("ASCENDING")
                        .build(),
                    IndexFieldArgs.builder()
                        .fieldPath("description")
                        .order("DESCENDING")
                        .build())
                .build());
    
        }
    }
    
    resources:
      database:
        type: gcp:firestore:Database
        properties:
          project: my-project-name
          name: database-id
          locationId: nam5
          type: FIRESTORE_NATIVE
          deleteProtectionState: DELETE_PROTECTION_DISABLED
          deletionPolicy: DELETE
      my-index:
        type: gcp:firestore:Index
        properties:
          project: my-project-name
          database: ${database.name}
          collection: atestcollection
          fields:
            - fieldPath: name
              order: ASCENDING
            - fieldPath: description
              order: DESCENDING
    

    Firestore Index Datastore Mode

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const database = new gcp.firestore.Database("database", {
        project: "my-project-name",
        name: "database-id-dm",
        locationId: "nam5",
        type: "DATASTORE_MODE",
        deleteProtectionState: "DELETE_PROTECTION_DISABLED",
        deletionPolicy: "DELETE",
    });
    const my_index = new gcp.firestore.Index("my-index", {
        project: "my-project-name",
        database: database.name,
        collection: "atestcollection",
        queryScope: "COLLECTION_RECURSIVE",
        apiScope: "DATASTORE_MODE_API",
        fields: [
            {
                fieldPath: "name",
                order: "ASCENDING",
            },
            {
                fieldPath: "description",
                order: "DESCENDING",
            },
        ],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    database = gcp.firestore.Database("database",
        project="my-project-name",
        name="database-id-dm",
        location_id="nam5",
        type="DATASTORE_MODE",
        delete_protection_state="DELETE_PROTECTION_DISABLED",
        deletion_policy="DELETE")
    my_index = gcp.firestore.Index("my-index",
        project="my-project-name",
        database=database.name,
        collection="atestcollection",
        query_scope="COLLECTION_RECURSIVE",
        api_scope="DATASTORE_MODE_API",
        fields=[
            {
                "field_path": "name",
                "order": "ASCENDING",
            },
            {
                "field_path": "description",
                "order": "DESCENDING",
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/firestore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
    			Project:               pulumi.String("my-project-name"),
    			Name:                  pulumi.String("database-id-dm"),
    			LocationId:            pulumi.String("nam5"),
    			Type:                  pulumi.String("DATASTORE_MODE"),
    			DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
    			DeletionPolicy:        pulumi.String("DELETE"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
    			Project:    pulumi.String("my-project-name"),
    			Database:   database.Name,
    			Collection: pulumi.String("atestcollection"),
    			QueryScope: pulumi.String("COLLECTION_RECURSIVE"),
    			ApiScope:   pulumi.String("DATASTORE_MODE_API"),
    			Fields: firestore.IndexFieldArray{
    				&firestore.IndexFieldArgs{
    					FieldPath: pulumi.String("name"),
    					Order:     pulumi.String("ASCENDING"),
    				},
    				&firestore.IndexFieldArgs{
    					FieldPath: pulumi.String("description"),
    					Order:     pulumi.String("DESCENDING"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var database = new Gcp.Firestore.Database("database", new()
        {
            Project = "my-project-name",
            Name = "database-id-dm",
            LocationId = "nam5",
            Type = "DATASTORE_MODE",
            DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
            DeletionPolicy = "DELETE",
        });
    
        var my_index = new Gcp.Firestore.Index("my-index", new()
        {
            Project = "my-project-name",
            Database = database.Name,
            Collection = "atestcollection",
            QueryScope = "COLLECTION_RECURSIVE",
            ApiScope = "DATASTORE_MODE_API",
            Fields = new[]
            {
                new Gcp.Firestore.Inputs.IndexFieldArgs
                {
                    FieldPath = "name",
                    Order = "ASCENDING",
                },
                new Gcp.Firestore.Inputs.IndexFieldArgs
                {
                    FieldPath = "description",
                    Order = "DESCENDING",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.firestore.Database;
    import com.pulumi.gcp.firestore.DatabaseArgs;
    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 database = new Database("database", DatabaseArgs.builder()
                .project("my-project-name")
                .name("database-id-dm")
                .locationId("nam5")
                .type("DATASTORE_MODE")
                .deleteProtectionState("DELETE_PROTECTION_DISABLED")
                .deletionPolicy("DELETE")
                .build());
    
            var my_index = new Index("my-index", IndexArgs.builder()
                .project("my-project-name")
                .database(database.name())
                .collection("atestcollection")
                .queryScope("COLLECTION_RECURSIVE")
                .apiScope("DATASTORE_MODE_API")
                .fields(            
                    IndexFieldArgs.builder()
                        .fieldPath("name")
                        .order("ASCENDING")
                        .build(),
                    IndexFieldArgs.builder()
                        .fieldPath("description")
                        .order("DESCENDING")
                        .build())
                .build());
    
        }
    }
    
    resources:
      database:
        type: gcp:firestore:Database
        properties:
          project: my-project-name
          name: database-id-dm
          locationId: nam5
          type: DATASTORE_MODE
          deleteProtectionState: DELETE_PROTECTION_DISABLED
          deletionPolicy: DELETE
      my-index:
        type: gcp:firestore:Index
        properties:
          project: my-project-name
          database: ${database.name}
          collection: atestcollection
          queryScope: COLLECTION_RECURSIVE
          apiScope: DATASTORE_MODE_API
          fields:
            - fieldPath: name
              order: ASCENDING
            - fieldPath: description
              order: DESCENDING
    

    Firestore Index Vector

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const database = new gcp.firestore.Database("database", {
        project: "my-project-name",
        name: "database-id-vector",
        locationId: "nam5",
        type: "FIRESTORE_NATIVE",
        deleteProtectionState: "DELETE_PROTECTION_DISABLED",
        deletionPolicy: "DELETE",
    });
    const my_index = new gcp.firestore.Index("my-index", {
        project: "my-project-name",
        database: database.name,
        collection: "atestcollection",
        fields: [
            {
                fieldPath: "field_name",
                order: "ASCENDING",
            },
            {
                fieldPath: "__name__",
                order: "ASCENDING",
            },
            {
                fieldPath: "description",
                vectorConfig: {
                    dimension: 128,
                    flat: {},
                },
            },
        ],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    database = gcp.firestore.Database("database",
        project="my-project-name",
        name="database-id-vector",
        location_id="nam5",
        type="FIRESTORE_NATIVE",
        delete_protection_state="DELETE_PROTECTION_DISABLED",
        deletion_policy="DELETE")
    my_index = gcp.firestore.Index("my-index",
        project="my-project-name",
        database=database.name,
        collection="atestcollection",
        fields=[
            {
                "field_path": "field_name",
                "order": "ASCENDING",
            },
            {
                "field_path": "__name__",
                "order": "ASCENDING",
            },
            {
                "field_path": "description",
                "vector_config": {
                    "dimension": 128,
                    "flat": {},
                },
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/firestore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
    			Project:               pulumi.String("my-project-name"),
    			Name:                  pulumi.String("database-id-vector"),
    			LocationId:            pulumi.String("nam5"),
    			Type:                  pulumi.String("FIRESTORE_NATIVE"),
    			DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
    			DeletionPolicy:        pulumi.String("DELETE"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
    			Project:    pulumi.String("my-project-name"),
    			Database:   database.Name,
    			Collection: pulumi.String("atestcollection"),
    			Fields: firestore.IndexFieldArray{
    				&firestore.IndexFieldArgs{
    					FieldPath: pulumi.String("field_name"),
    					Order:     pulumi.String("ASCENDING"),
    				},
    				&firestore.IndexFieldArgs{
    					FieldPath: pulumi.String("__name__"),
    					Order:     pulumi.String("ASCENDING"),
    				},
    				&firestore.IndexFieldArgs{
    					FieldPath: pulumi.String("description"),
    					VectorConfig: &firestore.IndexFieldVectorConfigArgs{
    						Dimension: pulumi.Int(128),
    						Flat:      nil,
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var database = new Gcp.Firestore.Database("database", new()
        {
            Project = "my-project-name",
            Name = "database-id-vector",
            LocationId = "nam5",
            Type = "FIRESTORE_NATIVE",
            DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
            DeletionPolicy = "DELETE",
        });
    
        var my_index = new Gcp.Firestore.Index("my-index", new()
        {
            Project = "my-project-name",
            Database = database.Name,
            Collection = "atestcollection",
            Fields = new[]
            {
                new Gcp.Firestore.Inputs.IndexFieldArgs
                {
                    FieldPath = "field_name",
                    Order = "ASCENDING",
                },
                new Gcp.Firestore.Inputs.IndexFieldArgs
                {
                    FieldPath = "__name__",
                    Order = "ASCENDING",
                },
                new Gcp.Firestore.Inputs.IndexFieldArgs
                {
                    FieldPath = "description",
                    VectorConfig = new Gcp.Firestore.Inputs.IndexFieldVectorConfigArgs
                    {
                        Dimension = 128,
                        Flat = null,
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.firestore.Database;
    import com.pulumi.gcp.firestore.DatabaseArgs;
    import com.pulumi.gcp.firestore.Index;
    import com.pulumi.gcp.firestore.IndexArgs;
    import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
    import com.pulumi.gcp.firestore.inputs.IndexFieldVectorConfigArgs;
    import com.pulumi.gcp.firestore.inputs.IndexFieldVectorConfigFlatArgs;
    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 database = new Database("database", DatabaseArgs.builder()
                .project("my-project-name")
                .name("database-id-vector")
                .locationId("nam5")
                .type("FIRESTORE_NATIVE")
                .deleteProtectionState("DELETE_PROTECTION_DISABLED")
                .deletionPolicy("DELETE")
                .build());
    
            var my_index = new Index("my-index", IndexArgs.builder()
                .project("my-project-name")
                .database(database.name())
                .collection("atestcollection")
                .fields(            
                    IndexFieldArgs.builder()
                        .fieldPath("field_name")
                        .order("ASCENDING")
                        .build(),
                    IndexFieldArgs.builder()
                        .fieldPath("__name__")
                        .order("ASCENDING")
                        .build(),
                    IndexFieldArgs.builder()
                        .fieldPath("description")
                        .vectorConfig(IndexFieldVectorConfigArgs.builder()
                            .dimension(128)
                            .flat()
                            .build())
                        .build())
                .build());
    
        }
    }
    
    resources:
      database:
        type: gcp:firestore:Database
        properties:
          project: my-project-name
          name: database-id-vector
          locationId: nam5
          type: FIRESTORE_NATIVE
          deleteProtectionState: DELETE_PROTECTION_DISABLED
          deletionPolicy: DELETE
      my-index:
        type: gcp:firestore:Index
        properties:
          project: my-project-name
          database: ${database.name}
          collection: atestcollection
          fields:
            - fieldPath: field_name
              order: ASCENDING
            - fieldPath: __name__
              order: ASCENDING
            - fieldPath: description
              vectorConfig:
                dimension: 128
                flat: {}
    

    Create Index Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Index(name: string, args: IndexArgs, opts?: CustomResourceOptions);
    @overload
    def Index(resource_name: str,
              args: IndexArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Index(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              collection: Optional[str] = None,
              fields: Optional[Sequence[IndexFieldArgs]] = None,
              api_scope: Optional[str] = None,
              database: Optional[str] = None,
              project: Optional[str] = None,
              query_scope: Optional[str] = None)
    func NewIndex(ctx *Context, name string, args IndexArgs, opts ...ResourceOption) (*Index, error)
    public Index(string name, IndexArgs args, CustomResourceOptions? opts = null)
    public Index(String name, IndexArgs args)
    public Index(String name, IndexArgs args, CustomResourceOptions options)
    
    type: gcp:firestore:Index
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args IndexArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args IndexArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args IndexArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IndexArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IndexArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var indexResource = new Gcp.Firestore.Index("indexResource", new()
    {
        Collection = "string",
        Fields = new[]
        {
            new Gcp.Firestore.Inputs.IndexFieldArgs
            {
                ArrayConfig = "string",
                FieldPath = "string",
                Order = "string",
                VectorConfig = new Gcp.Firestore.Inputs.IndexFieldVectorConfigArgs
                {
                    Dimension = 0,
                    Flat = null,
                },
            },
        },
        ApiScope = "string",
        Database = "string",
        Project = "string",
        QueryScope = "string",
    });
    
    example, err := firestore.NewIndex(ctx, "indexResource", &firestore.IndexArgs{
    	Collection: pulumi.String("string"),
    	Fields: firestore.IndexFieldArray{
    		&firestore.IndexFieldArgs{
    			ArrayConfig: pulumi.String("string"),
    			FieldPath:   pulumi.String("string"),
    			Order:       pulumi.String("string"),
    			VectorConfig: &firestore.IndexFieldVectorConfigArgs{
    				Dimension: pulumi.Int(0),
    				Flat:      nil,
    			},
    		},
    	},
    	ApiScope:   pulumi.String("string"),
    	Database:   pulumi.String("string"),
    	Project:    pulumi.String("string"),
    	QueryScope: pulumi.String("string"),
    })
    
    var indexResource = new Index("indexResource", IndexArgs.builder()
        .collection("string")
        .fields(IndexFieldArgs.builder()
            .arrayConfig("string")
            .fieldPath("string")
            .order("string")
            .vectorConfig(IndexFieldVectorConfigArgs.builder()
                .dimension(0)
                .flat()
                .build())
            .build())
        .apiScope("string")
        .database("string")
        .project("string")
        .queryScope("string")
        .build());
    
    index_resource = gcp.firestore.Index("indexResource",
        collection="string",
        fields=[{
            "arrayConfig": "string",
            "fieldPath": "string",
            "order": "string",
            "vectorConfig": {
                "dimension": 0,
                "flat": {},
            },
        }],
        api_scope="string",
        database="string",
        project="string",
        query_scope="string")
    
    const indexResource = new gcp.firestore.Index("indexResource", {
        collection: "string",
        fields: [{
            arrayConfig: "string",
            fieldPath: "string",
            order: "string",
            vectorConfig: {
                dimension: 0,
                flat: {},
            },
        }],
        apiScope: "string",
        database: "string",
        project: "string",
        queryScope: "string",
    });
    
    type: gcp:firestore:Index
    properties:
        apiScope: string
        collection: string
        database: string
        fields:
            - arrayConfig: string
              fieldPath: string
              order: string
              vectorConfig:
                dimension: 0
                flat: {}
        project: string
        queryScope: string
    

    Index Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Index resource accepts the following input properties:

    Collection string
    The collection being indexed.
    Fields List<IndexField>
    The fields supported by this index. The last non-stored 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.
    ApiScope string
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    Database string
    The Firestore database id. Defaults to '"(default)"'.
    Project string
    QueryScope string
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
    Collection string
    The collection being indexed.
    Fields []IndexFieldArgs
    The fields supported by this index. The last non-stored 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.
    ApiScope string
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    Database string
    The Firestore database id. Defaults to '"(default)"'.
    Project string
    QueryScope string
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
    collection String
    The collection being indexed.
    fields List<IndexField>
    The fields supported by this index. The last non-stored 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.
    apiScope String
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    database String
    The Firestore database id. Defaults to '"(default)"'.
    project String
    queryScope String
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
    collection string
    The collection being indexed.
    fields IndexField[]
    The fields supported by this index. The last non-stored 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.
    apiScope string
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    database string
    The Firestore database id. Defaults to '"(default)"'.
    project string
    queryScope string
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
    collection str
    The collection being indexed.
    fields Sequence[IndexFieldArgs]
    The fields supported by this index. The last non-stored 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.
    api_scope str
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    database str
    The Firestore database id. Defaults to '"(default)"'.
    project str
    query_scope str
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
    collection String
    The collection being indexed.
    fields List<Property Map>
    The fields supported by this index. The last non-stored 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.
    apiScope String
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    database String
    The Firestore database id. Defaults to '"(default)"'.
    project String
    queryScope String
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Index resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}

    Look up Existing Index Resource

    Get an existing Index resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: IndexState, opts?: CustomResourceOptions): Index
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api_scope: Optional[str] = None,
            collection: Optional[str] = None,
            database: Optional[str] = None,
            fields: Optional[Sequence[IndexFieldArgs]] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            query_scope: Optional[str] = None) -> Index
    func GetIndex(ctx *Context, name string, id IDInput, state *IndexState, opts ...ResourceOption) (*Index, error)
    public static Index Get(string name, Input<string> id, IndexState? state, CustomResourceOptions? opts = null)
    public static Index get(String name, Output<String> id, IndexState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ApiScope string
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    Collection string
    The collection being indexed.
    Database string
    The Firestore database id. Defaults to '"(default)"'.
    Fields List<IndexField>
    The fields supported by this index. The last non-stored 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.
    Name string
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    Project string
    QueryScope string
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
    ApiScope string
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    Collection string
    The collection being indexed.
    Database string
    The Firestore database id. Defaults to '"(default)"'.
    Fields []IndexFieldArgs
    The fields supported by this index. The last non-stored 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.
    Name string
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    Project string
    QueryScope string
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
    apiScope String
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    collection String
    The collection being indexed.
    database String
    The Firestore database id. Defaults to '"(default)"'.
    fields List<IndexField>
    The fields supported by this index. The last non-stored 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.
    name String
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    project String
    queryScope String
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
    apiScope string
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    collection string
    The collection being indexed.
    database string
    The Firestore database id. Defaults to '"(default)"'.
    fields IndexField[]
    The fields supported by this index. The last non-stored 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.
    name string
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    project string
    queryScope string
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
    api_scope str
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    collection str
    The collection being indexed.
    database str
    The Firestore database id. Defaults to '"(default)"'.
    fields Sequence[IndexFieldArgs]
    The fields supported by this index. The last non-stored 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.
    name str
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    project str
    query_scope str
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
    apiScope String
    The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
    collection String
    The collection being indexed.
    database String
    The Firestore database id. Defaults to '"(default)"'.
    fields List<Property Map>
    The fields supported by this index. The last non-stored 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.
    name String
    A server defined name for this index. Format: projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
    project String
    queryScope String
    The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]

    Supporting Types

    IndexField, IndexFieldArgs

    ArrayConfig string
    Indicates that this field supports operations on arrayValues. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: CONTAINS.
    FieldPath string
    Name of the field.
    Order string
    Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: ASCENDING, DESCENDING.
    VectorConfig IndexFieldVectorConfig
    Indicates that this field supports vector search operations. Only one of order, arrayConfig, and vectorConfig can be specified. Vector Fields should come after the field path __name__. Structure is documented below.
    ArrayConfig string
    Indicates that this field supports operations on arrayValues. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: CONTAINS.
    FieldPath string
    Name of the field.
    Order string
    Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: ASCENDING, DESCENDING.
    VectorConfig IndexFieldVectorConfig
    Indicates that this field supports vector search operations. Only one of order, arrayConfig, and vectorConfig can be specified. Vector Fields should come after the field path __name__. Structure is documented below.
    arrayConfig String
    Indicates that this field supports operations on arrayValues. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: CONTAINS.
    fieldPath String
    Name of the field.
    order String
    Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: ASCENDING, DESCENDING.
    vectorConfig IndexFieldVectorConfig
    Indicates that this field supports vector search operations. Only one of order, arrayConfig, and vectorConfig can be specified. Vector Fields should come after the field path __name__. Structure is documented below.
    arrayConfig string
    Indicates that this field supports operations on arrayValues. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: CONTAINS.
    fieldPath string
    Name of the field.
    order string
    Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: ASCENDING, DESCENDING.
    vectorConfig IndexFieldVectorConfig
    Indicates that this field supports vector search operations. Only one of order, arrayConfig, and vectorConfig can be specified. Vector Fields should come after the field path __name__. Structure is documented below.
    array_config str
    Indicates that this field supports operations on arrayValues. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: CONTAINS.
    field_path str
    Name of the field.
    order str
    Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: ASCENDING, DESCENDING.
    vector_config IndexFieldVectorConfig
    Indicates that this field supports vector search operations. Only one of order, arrayConfig, and vectorConfig can be specified. Vector Fields should come after the field path __name__. Structure is documented below.
    arrayConfig String
    Indicates that this field supports operations on arrayValues. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: CONTAINS.
    fieldPath String
    Name of the field.
    order String
    Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=. Only one of order, arrayConfig, and vectorConfig can be specified. Possible values are: ASCENDING, DESCENDING.
    vectorConfig Property Map
    Indicates that this field supports vector search operations. Only one of order, arrayConfig, and vectorConfig can be specified. Vector Fields should come after the field path __name__. Structure is documented below.

    IndexFieldVectorConfig, IndexFieldVectorConfigArgs

    Dimension int
    The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
    Flat IndexFieldVectorConfigFlat
    Indicates the vector index is a flat index.


    Dimension int
    The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
    Flat IndexFieldVectorConfigFlat
    Indicates the vector index is a flat index.


    dimension Integer
    The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
    flat IndexFieldVectorConfigFlat
    Indicates the vector index is a flat index.


    dimension number
    The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
    flat IndexFieldVectorConfigFlat
    Indicates the vector index is a flat index.


    dimension int
    The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
    flat IndexFieldVectorConfigFlat
    Indicates the vector index is a flat index.


    dimension Number
    The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
    flat Property Map
    Indicates the vector index is a flat index.


    Import

    Index can be imported using any of these accepted formats:

    • {{name}}

    When using the pulumi import command, Index can be imported using one of the formats above. For example:

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

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.5.0 published on Tuesday, Oct 8, 2024 by Pulumi