gcp.firestore.Index
Explore with Pulumi AI
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:
- API documentation
- 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 andlocation_id
set to your chosen location. If you wish to use App Engine, you may instead create agcp.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: &firestore.IndexFieldVectorConfigFlatArgs{},
},
},
},
})
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: {}
Firestore Index Name Descending
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: "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": "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("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 = "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("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: DESCENDING
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)
type: gcp:firestore:Index
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name
This property is required. string - The unique name of the resource.
- args
This property is required. IndexArgs - The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name
This property is required. str - The unique name of the resource.
- args
This property is required. 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
This property is required. string - The unique name of the resource.
- args
This property is required. IndexArgs - The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name
This property is required. string - The unique name of the resource.
- args
This property is required. IndexArgs - The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name
This property is required. String - The unique name of the resource.
- args
This property is required. 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: &firestore.IndexFieldVectorConfigFlatArgs{},
},
},
},
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=[{
"array_config": "string",
"field_path": "string",
"order": "string",
"vector_config": {
"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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Index resource accepts the following input properties:
- Collection
This property is required. Changes to this property will trigger replacement.
- The collection being indexed.
- Fields
This property is required. Changes to this property will trigger replacement.
Field> - 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 Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- Database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- Project
Changes to this property will trigger replacement.
- Query
Scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
- Collection
This property is required. Changes to this property will trigger replacement.
- The collection being indexed.
- Fields
This property is required. Changes to this property will trigger replacement.
Field Args - 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 Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- Database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- Project
Changes to this property will trigger replacement.
- Query
Scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
- collection
This property is required. Changes to this property will trigger replacement.
- The collection being indexed.
- fields
This property is required. Changes to this property will trigger replacement.
Field> - 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 Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- project
Changes to this property will trigger replacement.
- query
Scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
- collection
This property is required. Changes to this property will trigger replacement.
- The collection being indexed.
- fields
This property is required. Changes to this property will trigger replacement.
Field[] - 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 Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- project
Changes to this property will trigger replacement.
- query
Scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
- collection
This property is required. Changes to this property will trigger replacement.
- The collection being indexed.
- fields
This property is required. Changes to this property will trigger replacement.
Field Args] - 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 Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- project
Changes to this property will trigger replacement.
- query_
scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
- collection
This property is required. Changes to this property will trigger replacement.
- The collection being indexed.
- fields
This property is required. Changes to this property will trigger replacement.
- 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 Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- project
Changes to this property will trigger replacement.
- query
Scope Changes to this property will trigger replacement.
- 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:
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
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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
This property is required. - The unique name of the resulting resource.
- id
This property is required. - The unique provider ID of the resource to lookup.
- name
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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.
- Api
Scope Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- Collection
Changes to this property will trigger replacement.
- The collection being indexed.
- Database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- Fields
Changes to this property will trigger replacement.
Field> - 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
Changes to this property will trigger replacement.
- Query
Scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
- Api
Scope Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- Collection
Changes to this property will trigger replacement.
- The collection being indexed.
- Database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- Fields
Changes to this property will trigger replacement.
Field Args - 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
Changes to this property will trigger replacement.
- Query
Scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
- api
Scope Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- collection
Changes to this property will trigger replacement.
- The collection being indexed.
- database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- fields
Changes to this property will trigger replacement.
Field> - 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
Changes to this property will trigger replacement.
- query
Scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
- api
Scope Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- collection
Changes to this property will trigger replacement.
- The collection being indexed.
- database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- fields
Changes to this property will trigger replacement.
Field[] - 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
Changes to this property will trigger replacement.
- query
Scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
- api_
scope Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- collection
Changes to this property will trigger replacement.
- The collection being indexed.
- database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- fields
Changes to this property will trigger replacement.
Field Args] - 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
Changes to this property will trigger replacement.
- query_
scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
- api
Scope Changes to this property will trigger replacement.
- The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]
- collection
Changes to this property will trigger replacement.
- The collection being indexed.
- database
Changes to this property will trigger replacement.
- The Firestore database id. Defaults to '"(default)"'.
- fields
Changes to this property will trigger replacement.
- 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
Changes to this property will trigger replacement.
- query
Scope Changes to this property will trigger replacement.
- The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE"]
Supporting Types
IndexField, IndexFieldArgs
- Array
Config Changes to this property will trigger replacement.
- Indicates that this field supports operations on arrayValues. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:CONTAINS
. - Field
Path Changes to this property will trigger replacement.
- Name of the field.
- Order
Changes to this property will trigger replacement.
- Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=.
Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:ASCENDING
,DESCENDING
. - Vector
Config Changes to this property will trigger replacement.
Field Vector Config - Indicates that this field supports vector search operations. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Vector Fields should come after the field path__name__
. Structure is documented below.
- Array
Config Changes to this property will trigger replacement.
- Indicates that this field supports operations on arrayValues. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:CONTAINS
. - Field
Path Changes to this property will trigger replacement.
- Name of the field.
- Order
Changes to this property will trigger replacement.
- Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=.
Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:ASCENDING
,DESCENDING
. - Vector
Config Changes to this property will trigger replacement.
Field Vector Config - Indicates that this field supports vector search operations. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Vector Fields should come after the field path__name__
. Structure is documented below.
- array
Config Changes to this property will trigger replacement.
- Indicates that this field supports operations on arrayValues. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:CONTAINS
. - field
Path Changes to this property will trigger replacement.
- Name of the field.
- order
Changes to this property will trigger replacement.
- Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=.
Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:ASCENDING
,DESCENDING
. - vector
Config Changes to this property will trigger replacement.
Field Vector Config - Indicates that this field supports vector search operations. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Vector Fields should come after the field path__name__
. Structure is documented below.
- array
Config Changes to this property will trigger replacement.
- Indicates that this field supports operations on arrayValues. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:CONTAINS
. - field
Path Changes to this property will trigger replacement.
- Name of the field.
- order
Changes to this property will trigger replacement.
- Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=.
Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:ASCENDING
,DESCENDING
. - vector
Config Changes to this property will trigger replacement.
Field Vector Config - Indicates that this field supports vector search operations. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Vector Fields should come after the field path__name__
. Structure is documented below.
- array_
config Changes to this property will trigger replacement.
- Indicates that this field supports operations on arrayValues. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:CONTAINS
. - field_
path Changes to this property will trigger replacement.
- Name of the field.
- order
Changes to this property will trigger replacement.
- Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=.
Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:ASCENDING
,DESCENDING
. - vector_
config Changes to this property will trigger replacement.
Field Vector Config - Indicates that this field supports vector search operations. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Vector Fields should come after the field path__name__
. Structure is documented below.
- array
Config Changes to this property will trigger replacement.
- Indicates that this field supports operations on arrayValues. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:CONTAINS
. - field
Path Changes to this property will trigger replacement.
- Name of the field.
- order
Changes to this property will trigger replacement.
- Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=.
Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Possible values are:ASCENDING
,DESCENDING
. - vector
Config Changes to this property will trigger replacement.
- Indicates that this field supports vector search operations. Only one of
order
,arrayConfig
, andvectorConfig
can be specified. Vector Fields should come after the field path__name__
. Structure is documented below.
IndexFieldVectorConfig, IndexFieldVectorConfigArgs
- Dimension
Changes to this property will trigger replacement.
- The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
- Flat
Changes to this property will trigger replacement.
Field Vector Config Flat - Indicates the vector index is a flat index.
- Dimension
Changes to this property will trigger replacement.
- The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
- Flat
Changes to this property will trigger replacement.
Field Vector Config Flat - Indicates the vector index is a flat index.
- dimension
Changes to this property will trigger replacement.
- The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
- flat
Changes to this property will trigger replacement.
Field Vector Config Flat - Indicates the vector index is a flat index.
- dimension
Changes to this property will trigger replacement.
- The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
- flat
Changes to this property will trigger replacement.
Field Vector Config Flat - Indicates the vector index is a flat index.
- dimension
Changes to this property will trigger replacement.
- The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
- flat
Changes to this property will trigger replacement.
Field Vector Config Flat - Indicates the vector index is a flat index.
- dimension
Changes to this property will trigger replacement.
- The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.
- flat
Changes to this property will trigger replacement.
- 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.