> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lambdadb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Index types

> Reference for LambdaDB's nine index types — text, keyword, vector, sparse vector, boolean, datetime, long, double, and object — with analyzer options.

LambdaDB currently supports nine types of indexes. Note that the whole document is stored as is regardless of its existence in index configurations, but being stored does not necessarily mean it is searchable.

> [!WARNING]
>
> The dot (.) character cannot be used as a field name, and you can only add indexes to existing collections. Modifying or deleting existing indexes is not supported; only a field's optional [`description`](#field-descriptions) can change after creation.

## Field descriptions

Every index type, including each nested field under `objectIndexConfigs`, accepts an optional `description` string of up to 255 characters. It records what the field holds so that agents and SDK users can discover field meanings from a collection read. It never affects indexing or search, and it is the only setting of an existing field that can be added, changed, or cleared later; see [Configure a collection](https://docs.lambdadb.ai/guides/collections/manage-collections.md#field-descriptions). Collection reads return `description` only when one is set, and the server-managed `id` field does not accept one.

```python Python theme={null}
{
    "title": {
        "type": "text",
        "analyzers": ["english"],
        "description": "Product title shown in search results"
    },
    "metadata": {
        "type": "object",
        "objectIndexConfigs": {
            "sku": {"type": "keyword", "description": "Vendor stock-keeping unit"}
        }
    }
}
```

```json JSON theme={null}
{
    "title": {
        "type": "text",
        "analyzers": ["english"],
        "description": "Product title shown in search results"
    },
    "metadata": {
        "type": "object",
        "objectIndexConfigs": {
            "sku": {"type": "keyword", "description": "Vendor stock-keeping unit"}
        }
    }
}
```

## text

This type is for full-text values, such as the body of an email or the description of a product. These full-text values are analyzed by passing them through an analyzer to convert the string into a list of individual terms before being indexed. The analysis process allows LambdaDB to search for individual words within each full text field.

`text` indexes are best suited for unstructured but human-readable content. If you need to index structured content such as email addresses, hostnames, status codes, or tags, you should rather use a `keyword` index.

Choose one or more [supported analyzers](#supported-analyzers) for each text field. Omitting `analyzers` uses `["standard"]`. LambdaDB applies every analyzer you select; it does not automatically detect the language. See [Choose text analyzers](https://docs.lambdadb.ai/guides/collections/choose-text-analyzers.md) for single-language and multilingual selection, configuration examples, and the tradeoffs of combining analyzers.

```python Python theme={null}
{
    "content": {
        "type": "text",
        "analyzers": [
            "english",
            "korean",
            "japanese"
        ]
    }
}
```

```json JSON theme={null}
{
    "content": {
        "type": "text",
        "analyzers": [
            "english",
            "korean", 
            "japanese"
        ]
    }
}
```

## keyword

`keyword` type is used for structured content such as IDs, email addresses, hostnames, status codes, zip codes, or tags. Use keyword indexes for sorting, exact-value filters, and [keyword facets](https://docs.lambdadb.ai/guides/search/facets.md).

> [!NOTE]
>
> Keyword values longer than the [indexing limit](https://docs.lambdadb.ai/guides/get-started/limits.md#collections-and-schema) remain stored but are not indexed for filtering, sorting, or facets. This applies to each value in an array and does not impose the same limit on `text` fields. See [Limits](https://docs.lambdadb.ai/guides/get-started/limits.md#collections-and-schema) for character counting and other schema constraints.

You can also store multiple keyword values as an array for fields like tags or categories. Each distinct indexed value contributes once per document to a facet. [Array sorting](https://docs.lambdadb.ai/guides/search/sort.md#keyword-array-sorting) uses the smallest value for ascending order and the largest for descending order.

```python Python theme={null}
{
    "status": {"type": "keyword"},
    "category": {"type": "keyword"}
}
```

```json JSON theme={null}
{
    "status": {"type": "keyword"},
    "category": {"type": "keyword"}
}
```

## long

This type is for a signed 64-bit integer with a minimum value of $-2^{63}$ and a maximum value of $2^{63}-1$. `long` indexes are optimized for scoring, sorting, and range queries.

```python Python theme={null}
{
    "user_id": {"type": "long"},
    "timestamp": {"type": "long"}
}
```

```json JSON theme={null}
{
    "user_id": {"type": "long"},
    "timestamp": {"type": "long"}
}
```

## double

This type is for a double-precision 64-bit IEEE 754 floating point number, restricted to finite values. `double` indexes are optimized for scoring, sorting, and range queries.

```python Python theme={null}
{
    "score": {"type": "double"},
    "price": {"type": "double"}
}
```

```json JSON theme={null}
{
    "score": {"type": "double"},
    "price": {"type": "double"}
}
```

## boolean

`boolean` indexes accept JSON true and false values, but can also accept strings which are interpreted as either true or false.

```python Python theme={null}
{
    "is_active": {"type": "boolean"},
    "published": {"type": "boolean"}
}
```

```json JSON theme={null}
{
    "is_active": {"type": "boolean"},
    "published": {"type": "boolean"}
}
```

## datetime

This type is for date and time in [RFC 3339 format](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6). `datetime` indexes are optimized for sorting and range queries.

```python Python theme={null}
from datetime import datetime, timezone

# Example datetime usage
dt = datetime.now(timezone.utc)
print(dt.isoformat(timespec="seconds"))
# Output: 2024-11-05T14:27:56+00:00

# Index configuration
{
    "created_at": {"type": "datetime"},
    "updated_at": {"type": "datetime"}
}
```

```json JSON theme={null}
{
    "created_at": {"type": "datetime"},
    "updated_at": {"type": "datetime"}
}
```

## vector

The `vector` type indexes dense vectors of numeric values. `vector` indexes are primarily used for k-nearest neighbor (kNN) search. The vector type does not support aggregations or sorting. You add a vector field as an array of numeric values.

A kNN search finds the k nearest vectors to a query vector, as measured by a similarity metric. Dense vector fields support the `cosine` and `euclidean` similarity metrics within the [dimension limits](https://docs.lambdadb.ai/guides/get-started/limits.md#collections-and-schema). For caller-provided vector fields, metric names are case-sensitive; omitting `similarity` selects `cosine`. Document and query vectors must match the field's dimensions and contain only finite numbers. Cosine vectors must have nonzero magnitude.

LambdaDB supports two vector field modes:

* vector fields with caller-provided values, where you send vector values directly
* native embedding vector fields, where LambdaDB generates vector values from text or image source fields

LambdaDB also supports `multi-field vector search`, allowing you to perform kNN searches across multiple vector fields simultaneously within a single query. This enables complex semantic search scenarios where you can combine different types of embeddings (e.g., text embeddings, image embeddings) in one search operation.

```python Python theme={null}
{
    "embedding": {
        "type": "vector",
        "dimensions": 768,
        "similarity": "cosine"
    },
    "image_vector": {
        "type": "vector",
        "dimensions": 512,
        "similarity": "euclidean"
    }
}
```

```json JSON theme={null}
{
    "embedding": {
        "type": "vector",
        "dimensions": 768,
        "similarity": "cosine"
    },
    "image_vector": {
        "type": "vector",
        "dimensions": 512,
        "similarity": "euclidean"
    }
}
```

### Native embedding vector fields

Add an `embedding` block to let LambdaDB generate vectors from text or image fields in the document.

For supported models and configuration rules, see [Native embeddings](https://docs.lambdadb.ai/guides/collections/native-embeddings.md).

```python Python theme={null}
{
    "body": {
        "type": "text",
        "analyzers": ["english"]
    },
    "body_embedding": {
        "type": "vector",
        "embedding": {
            "provider": "openai",
            "model": "text-embedding-3-small",
            "sources": [{"field": "body", "type": "text"}]
        }
    }
}
```

```json JSON theme={null}
{
    "body": {
        "type": "text",
        "analyzers": ["english"]
    },
    "body_embedding": {
        "type": "vector",
        "embedding": {
            "provider": "openai",
            "model": "text-embedding-3-small",
            "sources": [{ "field": "body", "type": "text" }]
        }
    }
}
```

> [!NOTE]
>
> For native embedding vector fields:
>
> * `embedding.provider`, `embedding.model`, and `embedding.sources` are required
> * source fields are dotted paths in the stored document and do not need their own index configs
> * set `dimensions` and `similarity` inside `embedding`, not at the top level of the field
> * search with `knn.queryText` or `knn.queryInputs`; `knn.queryVector` is also accepted and skips inference
> * [bulk upsert](https://docs.lambdadb.ai/guides/collections/native-embeddings.md#bulk-upsert) never generates embeddings; a document with a present source must supply the vector directly

## sparseVector

The `sparseVector` type is designed for storing and indexing sparse vectors, where most elements are zero or missing. Unlike dense vectors, sparse vectors only store non-zero values along with their corresponding indexes. `sparseVector` type only supports the `dot_product` distance metric.

```python Python theme={null}
{
    "sparse_embedding": {"type": "sparseVector"}
}
```

```json JSON theme={null}
{
    "sparse_embedding": {"type": "sparseVector"}
}
```

## object

JSON documents are hierarchical in nature: the document may contain inner objects which, in turn, may contain inner objects themselves. Internally, this document is indexed as a simple, flat list of key-value pairs. The fields within the object can be of any data type, including object. `objectIndexConfigs` should be specified in order to index the fields inside the object.

```python Python theme={null}
{
    "metadata": {
        "type": "object",
        "objectIndexConfigs": {
            "url": {"type": "keyword"},
            "author": {"type": "keyword"},
            "content": {
                "type": "text",
                "analyzers": ["english", "korean"]
            }
        }
    }
}
```

```json JSON theme={null}
{
    "metadata": {
        "type": "object",
        "objectIndexConfigs": {
            "url": {"type": "keyword"},
            "author": {"type": "keyword"},
            "content": {
                "type": "text",
                "analyzers": ["english", "korean"]
            }
        }
    }
}
```

## Complete example configuration

Here's a comprehensive example that demonstrates all index types:

```python Python theme={null}
from lambdadb import models

complete_index_config = {
    "text": {
        "type": "text",
        "analyzers": [
            "japanese",
            "korean",
            "english",
        ],
    },
    "keyword": {"type": "keyword"},
    "long": {"type": "long"},
    "double": {"type": "double"},
    "boolean": {"type": "boolean"},
    "datetime": {"type": "datetime"},
    "vector": {
        "type": "vector",
        "dimensions": 64,
        "similarity": "cosine",
    },
    "sparseVector": {"type": "sparseVector"},
    "object": {
        "type": "object",
        "objectIndexConfigs": {
            "text": {
                "type": "text",
                "analyzers": [
                    "japanese",
                    "korean",
                    "english",
                ],
            },
            "keyword": {"type": "keyword"},
            "long": {"type": "long"},
            "double": {"type": "double"},
            "boolean": {"type": "boolean"},
            "datetime": {"type": "datetime"},
            "vector": {
                "type": "vector",
                "dimensions": 64,
                "similarity": "cosine",
            },
            "sparseVector": {"type": "sparseVector"},
        },
    },
}
```

```json JSON theme={null}
{
    "text": {
        "type": "text",
        "analyzers": [
            "japanese",
            "korean",
            "english"
        ]
    },
    "keyword": {"type": "keyword"},
    "long": {"type": "long"},
    "double": {"type": "double"},
    "boolean": {"type": "boolean"},
    "datetime": {"type": "datetime"},
    "vector": {
        "type": "vector",
        "dimensions": 64,
        "similarity": "cosine"
    },
    "sparseVector": {"type": "sparseVector"},
    "object": {
        "type": "object",
        "objectIndexConfigs": {
            "text": {
                "type": "text",
                "analyzers": [
                    "japanese",
                    "korean",
                    "english"
                ]
            },
            "keyword": {"type": "keyword"},
            "long": {"type": "long"},
            "double": {"type": "double"},
            "boolean": {"type": "boolean"},
            "datetime": {"type": "datetime"},
            "vector": {
                "type": "vector",
                "dimensions": 64,
                "similarity": "cosine"
            },
            "sparseVector": {"type": "sparseVector"}
        }
    }
}
```

## Supported analyzers

LambdaDB supports 49 fixed presets for `text` fields. The recommended [SDK, CLI, MCP server, and Migration CLI releases](https://docs.lambdadb.ai/reference/sdk/introduction.md#supported-sdk-versions) accept all 49 names.

| Analyzer | Description |
| :- | :- |
| `standard` | Default general-purpose Unicode text analysis |
| `english` | English |
| `korean` | Korean (Nori) |
| `japanese` | Japanese (Kuromoji) |
| `chinese` | Simplified Chinese word segmentation (SmartChinese); also processes mixed Chinese-English text |
| `cjk` | Overlapping two-character tokens for Chinese, Japanese, and Korean text |
| `arabic` | Arabic |
| `french` | French |
| `german` | German |
| `hindi` | Hindi |
| `indonesian` | Indonesian |
| `italian` | Italian |
| `portuguese` | Portuguese |
| `russian` | Russian |
| `spanish` | Spanish |
| `turkish` | Turkish |
| `armenian` | Armenian |
| `basque` | Basque |
| `bengali` | Bengali |
| `brazilian` | Brazilian Portuguese |
| `bulgarian` | Bulgarian |
| `catalan` | Catalan |
| `czech` | Czech |
| `danish` | Danish |
| `dutch` | Dutch |
| `estonian` | Estonian |
| `finnish` | Finnish |
| `galician` | Galician |
| `greek` | Greek |
| `hungarian` | Hungarian |
| `irish` | Irish |
| `latvian` | Latvian |
| `lithuanian` | Lithuanian |
| `norwegian` | Norwegian |
| `persian` | Persian |
| `romanian` | Romanian |
| `serbian` | Serbian |
| `sorani` | Sorani Kurdish |
| `swedish` | Swedish |
| `thai` | Thai |
| `simple` | Splits at non-letter characters and lowercases terms |
| `whitespace` | Splits at whitespace; preserves case |
| `stop` | Letter tokenization and lowercasing with the default English stopword set |
| `keyword` | One token for the entire value; preserves case and whitespace; remains a text field |
| `pattern` | Splits at Java `\W+` separators and lowercases; no stopwords or Unicode-character-class option |
| `fingerprint` | Lowercases, folds ASCII, sorts and deduplicates terms into one space-separated token; discards output over 255 UTF-16 code units |
| `nepali` | Nepali (Lucene extension) |
| `tamil` | Tamil (Lucene extension) |
| `telugu` | Telugu (Lucene extension) |

All names select fixed presets through `analyzers`; custom pipelines, tokenizers, filters, stopword lists, and analyzer options are not configurable. The `keyword` analyzer on a `text` field does not provide the sorting or facet behavior of a `keyword` field type. `nepali`, `tamil`, and `telugu` are Lucene extensions, not shared Elasticsearch/OpenSearch analyzer support.

Use the lowercase names above. Duplicate analyzer names, including case variants, are rejected with HTTP 400. Omit `analyzers` for the default, or select at least one analyzer; an empty list does not use the default. See [Choose text analyzers](https://docs.lambdadb.ai/guides/collections/choose-text-analyzers.md) before combining analyzers or migrating an existing field.

> [!NOTE]
>
> Ask in the [LambdaDB community Slack](https://join.slack.com/t/lambdadbcommunity/shared_invite/zt-3sg7565zm-sCTW3odRkEQt~auWUVVsTw) or email [support@lambdadb.ai](mailto:support@lambdadb.ai) if you need an analyzer not listed above.

## Supported similarity metrics

| Metric | Description | Use Case |
| :- | :- | :- |
| `cosine` | Cosine similarity | Most common for text embeddings |
| `euclidean` | Euclidean distance | Geometric distance calculations |

These options apply to dense `vector` fields. Dense `dot_product` and `max_inner_product` are not supported. Changing an inner-product workload to cosine can change ranking when vector magnitudes carry information; validate the retrieval objective before migrating. The `sparseVector` type continues to use `dot_product` without a unit-length requirement.

Dense-vector query results contain relevance scores, not raw distances or inner products. Validate score thresholds separately when migrating between systems.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.