Overview
The Composite JSON index is an enhanced version of the JSON index. It indexes flattened JSON records and can add specialized per-path indexes for commonJSON_MATCH predicates.
The Composite JSON index is available from StarTree version 0.11.0. Compact doc ID mapping and the related
JSON_MATCH query-path performance improvements are available after the StarTree 0.15 release.- Equality,
IN,NOT IN,IS NULL, orIS NOT NULLfilters on selected JSON paths. - Range filters on numeric JSON fields.
- Text search with
TEXT_MATCHon selected JSON paths. - Regex or prefix-style filters with
REGEXP_LIKEon selected paths accelerated by an FST index. - Count filters over the number of matching flattened records in a JSON document.
Configure the Index
Add the Composite JSON index under the column’sfieldConfigList[].indexes entry.
includeAllPaths:
Configuration Parameters
The Composite JSON index supports the JSON index optionsmaxLevels, excludeArray, disableCrossArrayUnnest, includePaths, excludePaths, excludeFields, indexPaths, maxValueLength, and skipInvalidJson.
It also supports these Composite JSON options:
Range Indexes
UserangeIndexConfigs for JSON paths that appear in range predicates.
The range index has one value for each flattened record. If a value is missing or unparseable, Pinot uses the configured
defaultValue, or the type default when defaultValue is omitted. This can affect unbounded range queries. For example, if the default value is 0, this query can include documents without $.value:
Text Indexes
UsetextIndexConfigs for JSON paths queried with TEXT_MATCH.
name must be unique. Text index configs also accept the same fields supported by a regular text index, including:
FST Indexes
FST indexes within Composite JSON were added in StarTree 0.12.
fstIndexConfigs to accelerate REGEXP_LIKE predicates on selected JSON paths.
invertedIndexPartitionCount is greater than 1; queries fall back to dictionary scanning.
Compact Doc ID Mapping
Compact doc ID mapping is available after the StarTree 0.15 release.
(numDocs + 1) * 4 byte int[] mapping for this translation, even when the JSON column was array-free and each document produced at most one flattened record.
For array-free columns, the mapping can dominate index size and query latency. On an 11.3M-row segment with about 8% empty JSON documents, the full mapping was about 45 MB. With compact doc ID mapping, the same shape can store a small null-docs bitmap instead, around 125 KB in that measured case.
Enable compact mapping with enableCompactDocIdMapping:
Eligibility
The flag allows compact mapping, but the index creator still chooses the smallest safe representation for each new immutable segment.
With
enableCompactDocIdMapping omitted or set to false, all new segments keep the legacy full int[] mapping.
Rollout and Rollback
enableCompactDocIdMapping is read only while creating new immutable segments. Changing the setting does not rewrite existing segments by itself.
Use this rollout order:
- Upgrade every component that may read Composite JSON indexes.
- Set
enableCompactDocIdMapping: trueon the target column. - Rebuild, refresh, or re-commit the affected segments so new segments are written with the compact representation when eligible.
- Set
enableCompactDocIdMapping: false. - Refresh or re-commit any affected compact segments so they are written with the legacy mapping.
- Downgrade only after no compact-mapping segments remain.
Query Examples
Equality
Range Query
Text Search
Regex Search with FST
Count Filter
Use the optional third argument to filter by the number of matching flattened records per document.IS NULL, a count filter can distinguish empty JSON documents from present documents where the path is absent:
Array Position Indexing
Queries that specify a concrete array position requireenablePositionalIndexing: true, even when the same path is also range-indexed.
enablePositionalIndexing is false, use wildcard paths such as $.grades[*].value instead.
Range Queries on Real-Time Tables
For committed immutable segments, range predicates can use the internal Composite JSON range index. Mutable consuming segments rely on the inverted index path. When you use Composite JSON range predicates on a real-time or hybrid table, include the same JSON path ininvertedIndexConfigs. Otherwise, mutable consuming segments can return no rows for that predicate until they commit.
Performance Notes
The following comparisons were measured on internal Composite JSON benchmarks for the improvements available after the StarTree 0.15 release.
Recent Composite JSON query-path improvements also avoid cloning read-only postings for compact identity segments and speed up the legacy remap path for array and full-mapping segments. Those improvements require no table-config changes.

