Implementation:Lance format Lance Java IndexDescription
| Knowledge Sources | |
|---|---|
| Domains | Java_SDK, Indexing |
| Last Updated | 2026-02-08 19:33 GMT |
Overview
Description
IndexDescription is a final Java class in the org.lance.index package that provides a high-level description of an index, aggregating metadata across all segments. It mirrors the Rust IndexDescription trait and is returned from Dataset.describeIndices. The class holds the index name, field IDs, the underlying protobuf type URL, a human-readable index type identifier, the approximate number of rows indexed, per-segment Index metadata, and an optional JSON representation of index-specific details.
Usage
IndexDescription objects are returned by the Lance Java SDK when calling dataset describe-indices APIs. They give callers a comprehensive view of each index including its type, coverage, and implementation-specific details. All required fields are validated with Objects.requireNonNull in the constructor.
Code Reference
Source Location
java/src/main/java/org/lance/index/IndexDescription.java
Signature
public final class IndexDescription {
public IndexDescription(
String name,
List<Integer> fieldIds,
String typeUrl,
String indexType,
long rowsIndexed,
List<Index> metadata,
String detailsJson);
public String getName();
public List<Integer> getFieldIds();
public String getTypeUrl();
public String getIndexType();
public long getRowsIndexed();
public List<Index> getMetadata();
public String getDetailsJson();
}
Import
import org.lance.index.IndexDescription;
I/O Contract
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
String |
Yes | Logical name of the index |
fieldIds |
List<Integer> |
Yes | Field IDs the index is built on |
typeUrl |
String |
Yes | Underlying protobuf type URL for index details |
indexType |
String |
Yes | Human-readable index type (e.g., BTREE, INVERTED, IVF_PQ) |
rowsIndexed |
long |
Yes | Approximate number of rows covered |
metadata |
List<Index> |
Yes | Per-segment Index metadata objects |
detailsJson |
String |
No | JSON representation of index-specific details (may be null) |
| Method | Return Type | Description |
|---|---|---|
getName() |
String |
The logical index name |
getFieldIds() |
List<Integer> |
Field IDs covered by the index |
getTypeUrl() |
String |
Protobuf type URL for details |
getIndexType() |
String |
Human-readable index type identifier |
getRowsIndexed() |
long |
Approximate rows indexed |
getMetadata() |
List<Index> |
Per-segment metadata |
getDetailsJson() |
String |
JSON details string (may be null) |
Usage Examples
import org.lance.index.IndexDescription;
import org.lance.index.Index;
// IndexDescription is typically returned from dataset APIs
// Example: inspecting an IndexDescription
IndexDescription desc = dataset.describeIndices(criteria).get(0);
System.out.println("Index: " + desc.getName());
System.out.println("Type: " + desc.getIndexType());
System.out.println("Rows indexed: " + desc.getRowsIndexed());
System.out.println("Fields: " + desc.getFieldIds());
// Iterate per-segment metadata
for (Index seg : desc.getMetadata()) {
System.out.println(" Segment UUID: " + seg.uuid());
System.out.println(" Version: " + seg.indexVersion());
}
// Access raw JSON details if available
if (desc.getDetailsJson() != null) {
System.out.println("Details: " + desc.getDetailsJson());
}
Related Pages
- Index - Per-segment index metadata contained in the description
- IndexCriteria - Criteria used to filter which index descriptions are returned
- IndexType - Enum of index type identifiers