Stay organized with collectionsSave and categorize content based on your preferences.
Creates the specified index. A newly created index's initial state isCREATING. On completion of the returnedgoogle.longrunning.Operation, the state will beREADY. If the index already exists, the call will return anALREADY_EXISTSstatus.
During creation, the process could result in an error, in which case the index will move to theERRORstate. The process can be recovered by fixing the data that caused the error, removing the index withdelete, then re-creating the index withcreate.
Indexes with a single field cannot be created.
HTTP request
POST https://firestore.googleapis.com/v1beta1/{parent=projects/*/databases/*}/indexes
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-19 UTC."],[[["\u003cp\u003eCreates a new index, which initially starts in a \u003ccode\u003eCREATING\u003c/code\u003e state and transitions to \u003ccode\u003eREADY\u003c/code\u003e upon successful completion.\u003c/p\u003e\n"],["\u003cp\u003eIf an index creation fails, it enters an \u003ccode\u003eERROR\u003c/code\u003e state, but it can be recovered by correcting the underlying data issue, deleting the index, and recreating it.\u003c/p\u003e\n"],["\u003cp\u003eThe process uses an HTTP POST request to a specific URL with required parameters like \u003ccode\u003eparent\u003c/code\u003e for the database location.\u003c/p\u003e\n"],["\u003cp\u003eThe request body contains index details, and the response body will include an operation object if the creation is successful.\u003c/p\u003e\n"],["\u003cp\u003eThe creation of single field indexes is not supported by this process.\u003c/p\u003e\n"]]],[],null,["# Method: projects.databases.indexes.create\n\nCreates the specified index. A newly created index's initial state is `CREATING`. On completion of the returned [google.longrunning.Operation](/firestore/docs/reference/rest/Shared.Types/Operation), the state will be `READY`. If the index already exists, the call will return an `ALREADY_EXISTS` status.\n\nDuring creation, the process could result in an error, in which case the index will move to the `ERROR` state. The process can be recovered by fixing the data that caused the error, removing the index with [delete](/firestore/docs/reference/rest/v1beta1/projects.databases.indexes/delete#google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex), then re-creating the index with [create](/firestore/docs/reference/rest/v1beta1/projects.databases.indexes/create#google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex).\n\nIndexes with a single field cannot be created.\n\n### HTTP request\n\n`POST https://firestore.googleapis.com/v1beta1/{parent=projects/*/databases/*}/indexes`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains an instance of [Index](/firestore/docs/reference/rest/v1beta1/projects.databases.indexes#Index).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Operation](/firestore/docs/reference/rest/Shared.Types/Operation).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/datastore`\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]