Table
Index
Metadata

Create an index on a table

Create an index on a table column for faster search operations. Supports vector indexes (IVF_FLAT, IVF_HNSW_SQ, IVF_PQ, etc.) and scalar indexes (BTREE, BITMAP, FTS, etc.). Index creation is handled asynchronously. Use the ListTableIndices and DescribeTableIndexStats operations to monitor index creation progress.

post/v1/table/{id}/create_index

Path parameters

idstring required

string identifier of an object in a namespace, following the Lance Namespace spec. When the value is equal to the delimiter, it represents the root namespace. For example, v1/namespace/./list performs a ListNamespace on the root namespace.

Query parameters

delimiterstring nullable

An opaque token that allows pagination for list APIs (e.g. ListNamespaces). For an initial client request for a list API, if the server cannot return all items in one response, or if there are more items than the pageSize specified in the client request, the server must return a nextPageToken in the response indicating there are more results available. After the initial request, the value of nextPageToken from each response must be used by the client as the pageToken parameter value for the next request. Clients must interpret either null, missing value or empty string value of nextPageToken from a server response as the end of the listing results.

An optional delimiter of the string identifier, following the Lance Namespace spec. When not specified, the . delimiter must be used.

Request body

namestring required

The table name

namespacestring[] required

The namespace identifier

columnstring required

Name of the column to create index on

index_type'BTREE' | 'BITMAP' | 'LABEL_LIST' | 'IVF_FLAT' | 'IVF_HNSW_SQ' | 'IVF_PQ' | 'FTS' required

Type of index to create

metric_type'l2' | 'cosine' | 'dot' nullable

Distance metric type for vector indexes

with_positionboolean nullable

Optional FTS parameter for position tracking

base_tokenizerstring nullable

Optional FTS parameter for base tokenizer

languagestring nullable

Optional FTS parameter for language

max_token_lengthinteger nullable

Optional FTS parameter for maximum token length

lower_caseboolean nullable

Optional FTS parameter for lowercase conversion

stemboolean nullable

Optional FTS parameter for stemming

remove_stop_wordsboolean nullable

Optional FTS parameter for stop word removal

ascii_foldingboolean nullable

Optional FTS parameter for ASCII folding

Example request

{
  "base_tokenizer": "base_tokenizer",
  "column": "column",
  "max_token_length": 0,
  "language": "language",
  "index_type": "BTREE",
  "with_position": true,
  "lower_case": true,
  "name": "name",
  "namespace": [
    "namespace",
    "namespace"
  ],
  "metric_type": "l2",
  "ascii_folding": true,
  "remove_stop_words": true,
  "stem": true
}

Response

Index created successfully

namestring required

The table name

namespacestring[] required

The namespace identifier

locationstring required

Table location (usually empty)

{"stackTrail":"components:schemas:CreateTableIndexResponse:properties:properties","oasType":"schema","type":"unknown","description":"Additional properties (usually empty)"}

Example response

{
  "name": "name",
  "namespace": [
    "namespace",
    "namespace"
  ],
  "location": "location",
  "properties": {
    "key": "properties"
  }
}

Changes