Skip to main content
POST
/
v1
/
table
/
{name}
/
create_index
Create Index
curl --request POST \
  --url https://{db}.{region}.api.lancedb.com/v1/table/{name}/create_index \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "index_type": "IVF_PQ",
  "column": "vector",
  "distance_type": "L2",
  "with_position": true,
  "base_tokenizer": "simple",
  "language": "English",
  "max_token_length": 40,
  "lower_case": false,
  "stem": false,
  "remove_stop_words": false,
  "ascii_folding": false
}'
{}

Authorizations

x-api-key
string
header
required

Path Parameters

name
string
required

name of the table

Body

application/json
index_type
enum<string>
required

Type of index to create for optimizing search performance.

Vector Indexes:

  • IVF_PQ: Default vector index using Inverted File with Product Quantization. Optimized for high-dimensional vectors with excellent compression.
  • IVF_HNSW_SQ: Combines IVF clustering with HNSW graph and Scalar Quantization for improved search quality and speed.

Scalar Indexes:

  • BTREE: B-tree index for efficient range queries and equality comparisons on scalar data.
  • BITMAP: Bitmap index for high-cardinality categorical data with fast boolean operations.
  • LABEL_LIST: Optimized for label-based filtering and categorical data with limited unique values.

Full-Text Search:

  • FTS: Full-text search index using BM25 algorithm for keyword-based search on text columns.
Available options:
IVF_PQ,
IVF_HNSW_SQ,
BTREE,
BITMAP,
LABEL_LIST,
FTS
column
string

The column to index. Required for vector indexes when multiple vector columns exist. For scalar and FTS indexes, specifies the target column.

Example:

"vector"

distance_type
enum<string>

Distance metric for vector indexes. Required for vector index types. Must match the metric used by your embedding model for optimal results.

Available options:
L2,
Cosine,
Dot
with_position
boolean
default:true

Whether to store token positions for FTS indexes. Required for phrase search functionality.

base_tokenizer
enum<string>
default:simple

Tokenizer for FTS indexes. Simple tokenizer is recommended for most use cases.

Available options:
simple,
whitespace,
unicode
language
string
default:English

Language for stemming and stop words in FTS indexes. Affects search behavior and index size.

max_token_length
integer
default:40

Maximum token length for FTS indexes. Longer tokens are ignored to prevent index bloat.

Required range: 1 <= x <= 100
lower_case
boolean
default:false

Whether to convert tokens to lowercase in FTS indexes. Improves search consistency.

stem
boolean
default:false

Whether to apply stemming in FTS indexes. Reduces index size but may affect search precision.

remove_stop_words
boolean
default:false

Whether to remove stop words in FTS indexes. Reduces index size and noise.

ascii_folding
boolean
default:false

Whether to convert non-ASCII characters to ASCII in FTS indexes. Useful for accent-insensitive search.

Response

Vector index is created successfully

The response is of type object.