Skip to content

Commit 256da39

Browse files
committed
docs: document array_index_mode for STE-VEC indexes
Add documentation for the new array_index_mode configuration option in the searchable JSON reference guide, including preset values and object form for fine-grained control over array indexing behavior.
1 parent c1a6efe commit 256da39

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

docs/reference/searchable-json.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This document outlines the supported JSONB functions and operators in CipherStas
3333
```
3434

3535
### Encrypted column configuration
36-
```
36+
```sql
3737
SELECT eql_v2.add_search_config(
3838
'cipherstash',
3939
'encrypted_jsonb',
@@ -45,6 +45,65 @@ SELECT eql_v2.add_search_config(
4545

4646
> **Note:** JSONB literals in INSERT and UPDATE statements work directly without explicit `::jsonb` type casts. The proxy infers the JSONB type from the target column and handles encryption transparently.
4747
48+
#### Configuration options
49+
50+
The `ste_vec` index configuration accepts the following options:
51+
52+
| Option | Type | Default | Description |
53+
|--------|------|---------|-------------|
54+
| `prefix` | string | (required) | Unique prefix for the index, typically `table/column` |
55+
| `term_filters` | array | `[]` | Filters applied to indexed terms (e.g., `[{"kind": "downcase"}]`) |
56+
| `array_index_mode` | string or object | `"all"` | Controls which array selectors are generated during indexing |
57+
58+
#### Array index mode
59+
60+
The `array_index_mode` option controls how arrays within JSONB documents are indexed. This affects which JSONPath selectors can be used to query array data.
61+
62+
**Preset values:**
63+
64+
- `"all"` (default) - Generates all selector types. This is backwards compatible with existing configurations.
65+
- `"none"` - Disables array indexing entirely.
66+
67+
**Object form for fine-grained control:**
68+
69+
```json
70+
{
71+
"item": true,
72+
"wildcard": true,
73+
"position": false
74+
}
75+
```
76+
77+
| Selector | JSONPath | Description |
78+
|----------|----------|-------------|
79+
| `item` | `[@]` | EQL array element selector for functions like `jsonb_array_length` |
80+
| `wildcard` | `[*]` | Standard JSONPath wildcard for iterating array elements |
81+
| `position` | `[0]`, `[1]`, etc. | Positional access to specific array indices |
82+
83+
**Example with array_index_mode:**
84+
85+
```sql
86+
SELECT eql_v2.add_search_config(
87+
'cipherstash',
88+
'encrypted_jsonb',
89+
'ste_vec',
90+
'jsonb',
91+
'{"prefix": "cipherstash/encrypted_jsonb", "array_index_mode": "all"}'
92+
);
93+
```
94+
95+
**Example disabling positional indexing:**
96+
97+
```sql
98+
SELECT eql_v2.add_search_config(
99+
'events',
100+
'payload',
101+
'ste_vec',
102+
'jsonb',
103+
'{"prefix": "events/payload", "array_index_mode": {"item": true, "wildcard": true, "position": false}}'
104+
);
105+
```
106+
48107
### JSON document structure
49108

50109
Examples assume an encrypted JSON document with the following structure:

0 commit comments

Comments
 (0)