create_index

Use the create index operation to create vector or metadata indexes on a table to enable fast similarity search.

The operation creates an index for efficient approximate nearest neighbor (ANN) search. The index creation runs asynchronously as a background job. Use describe_index or describe_index_job to monitor progress.

Supports IVF (Inverted File) and HNSW (Hierarchical Navigable Small World) indexes. When index_params are omitted, ORDS creates an index with server-side defaults. In the 26.2 request model, use index_params.vector_index_params to configure the vector index and index_params.metadata_index_params to configure metadata path indexing. You can provide either object or both.

Parameters

Parameter Type Value Range Required Default Description Notes
table_name str Valid vector table identifier Yes No default Name of the vector table to index. Table must exist in the database schema.
index_params dict Object or NULL No None Vector and metadata index configuration. Accepted top-level keys are vector_index_params, metadata_index_params, and parallel_creation. Omit to use server-side defaults.
debug_flags dict Object or NULL No None Debug or tracing flags for detailed logging. Optional; omit unless diagnostics are needed.

For IVF indexes, set query-time probes through advanced_options['idx_parameters']['neighbor partition probes']. This parameter is IVF-only.

Raises InvalidTableNameFormatError is raised when the table name is invalid.

Create index with default IVF settings

response = client.create_index(table_name='products')

Create HNSW index with custom parameters

response = client.create_index(
    table_name='products',
    index_params={
        'vector_index_params': {
            'auto_index': True,
            'organization': 'INMEMORY GRAPH',
            'distance_metric': 'COSINE',
            'quantization_type': 'SCALAR',
            'compression_ratio': 4,
            'distribute_params': {
                'distribute_method': 'AUTO'
            },
            'advanced_params': {
                'neighbors': 32,
                'efConstruction': 200,
                'rescore_factor': 10,
                'algorithm': 'uniform_quantization'
            }
        },
        'metadata_index_params': {
            'auto_index': True,
            'include_paths': ['tenant', 'category'],
            'exclude_paths': ['body']
        },
        'parallel_creation': 4
    }
)
print(response)

Create IVF index with explicit defaults

response = client.create_index(
    table_name='products',
    index_params={
        'vector_index_params': {
            'organization': 'PARTITIONS',
            'distance_metric': 'COSINE',
            'advanced_params': {
                'partitions': 16
            }
        }
    }
)
print(response)

Monitor index creation progress

status = client.describe_index(table_name='products')

Return type JobResponse

Returns JSON response containing the index job ID and status.