Indexes

Create index

Create a new index.

Note: Indexing the system attribute _id is not supported for user-defined indexes. Manually creating an index using _id as an index attribute fails with an error.

post/_fabric/{fabric}/_api/index/general

Request

Path parameters

fabricstring string required

The name of the fabric.

Query parameters

collectionstring required

The collection name.

Request body

fieldsstring[] required

An array of attribute names. Currently, the array is limited to exactly one attribute.

namestring

Name of index.

typestring required

Must be equal to "fulltext".

sparseboolean

True if index is sparse type.

Note: Hash, skiplist and persistent indexes can optionally be created in a sparse variant. Sparse indexes do not index documents for which any of the index attributes is either not set or is null.

uniqueboolean

True if index is unique.

Note: Unique indexes on non-shard keys are not supported in a cluster. The following index types do not support uniqueness and using the unique attribute with these types may lead to an error:

  • geo indexes
  • fulltext indexes
deduplicateboolean

True it controls whether inserting duplicate index values from the same document into a unique array index leads to a unique constraint error or not.

Example request

{
  "fields": [
    "_key"
  ],
  "name": "idx_1723573111790501888",
  "type": "fulltext"
}

Response

Successfully fetched existing index.

codeinteger

HTTP response code.

errorboolean

Flag if there is an error in response. False for this response.

fieldsstring[]

Array of fields on which index is created.

idstring

Index identifier.

namestring

Name of the index.

selectivityEstimatenumber

The selectivity estimate of index.

sparseboolean

True if index is sparse type.

typestring

Index type.

uniqueboolean

True if index is unique.

expireAfternumber

Index expiry time.

Example response

{
  "code": 200,
  "fields": [
    "_key"
  ],
  "id": "61862387",
  "name": "idx_1723573111790501888",
  "selectivityEstimate": 1,
  "type": "fulltext",
  "unique": true,
  "expireAfter": 3600
}

Changes

No recorded changes to this operation across all 1 revision of this API.