Table
Index
Metadata

Create a scalar index on a table

Changed on

Create a scalar index on a table field for faster filtering operations. Supports scalar indexes (BTREE, BITMAP, LABEL_LIST, FTS, etc.). This is an alias for CreateTableIndex specifically for scalar indexes. Index creation is handled asynchronously. Use the ListTableIndices and DescribeTableIndexStats operations to monitor index creation progress.

post/v1/table/{id}/create_scalar_index

Request

  • Base URL
    http://localhost:2333
  • Auth
    • OAuth 2
      Client credentials
      Token URL: /oauth/token
    • or HTTP bearer
    • or API key in header x-api-key

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

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

Request body

contextunknown
idstring[]
branchstring

Branch to target. When not specified, the main branch is used.

columnstring required

Lance field path to create the index on. Nested fields use dot-separated segments; use backtick-quoted segments for literal dots and double backticks inside quoted segments. Use canonical full paths for display and errors; leaf names alone only identify top-level fields; invalid or unresolved paths should return InvalidInput or TableColumnNotFound.

index_typestring required

Type of index to create (e.g., BTREE, BITMAP, LABEL_LIST, IVF_FLAT, IVF_PQ, IVF_HNSW_SQ, FTS)

namestring nullable

Optional name for the index. If not provided, a name will be auto-generated.

distance_typestring

Distance metric type for vector indexes (e.g., l2, cosine, dot)

num_partitionsinteger nullable

Optional vector index parameter for the number of IVF partitions. Applies to all IVF index types.

num_sub_vectorsinteger nullable

Optional vector index parameter for the number of PQ sub-vectors. Applies to IVF_PQ only.

num_bitsinteger nullable

Optional vector index parameter for the number of bits used by the quantizer.

sample_rateinteger nullable

Optional vector index parameter for the per-partition sample rate used during IVF training.

max_iterationsinteger nullable

Optional vector index parameter for the maximum number of IVF k-means training iterations.

target_partition_sizeinteger nullable

Optional vector index parameter for the target partition size. Alternative to num_partitions.

minteger nullable

Optional vector index parameter for the number of edges per node in the HNSW graph. Applies to HNSW index types.

ef_constructioninteger nullable

Optional vector index parameter for the number of candidates evaluated during HNSW graph construction. Applies to HNSW index types.

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

{
  "max_iterations": 1,
  "base_tokenizer": "base_tokenizer",
  "column": "column",
  "max_token_length": 0,
  "language": "language",
  "branch": "branch",
  "m": 1,
  "index_type": "index_type",
  "with_position": true,
  "num_sub_vectors": 1,
  "sample_rate": 1,
  "lower_case": true,
  "distance_type": "distance_type",
  "identity": {
    "api_key": "api_key",
    "auth_token": "auth_token"
  },
  "context": {
    "key": "context"
  },
  "name": "name",
  "target_partition_size": 1,
  "ef_construction": 1,
  "ascii_folding": true,
  "id": [
    "id",
    "id"
  ],
  "num_partitions": 1,
  "num_bits": 1,
  "remove_stop_words": true,
  "stem": true
}

Response

Scalar index created successfully

contextunknown
transaction_idstring

Optional transaction identifier

Example response

{
  "transaction_id": "transaction_id",
  "context": {
    "key": "context"
  }
}

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status