You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EQL provides specialized functions to interact with encrypted JSONB data, supporting operations like containment queries, field extraction, and comparisons.
122
121
123
-
### Containment Queries (`cs_ste_vec_v1`)
122
+
### Containment queries (`cs_ste_vec_v1`)
124
123
125
124
Retrieve the Structured Encryption Vector for JSONB containment queries.
126
125
127
-
**Example: Containment Query**
126
+
**Example: Containment query**
128
127
129
128
Suppose we have the following encrypted JSONB data:
130
129
@@ -138,7 +137,7 @@ Suppose we have the following encrypted JSONB data:
138
137
139
138
We can query records that contain a specific structure.
140
139
141
-
**SQL Query:**
140
+
**SQL query:**
142
141
143
142
```sql
144
143
SELECT*FROM examples
@@ -162,11 +161,11 @@ WHERE jsonb_column @> '{"top":{"nested":["a"]}}';
162
161
163
162
**Note:** The `@>` operator checks if the left JSONB value contains the right JSONB value.
164
163
165
-
**Negative Example:**
164
+
**Negative example:**
166
165
167
166
If we query for a value that does not exist in the data:
168
167
169
-
**SQL Query:**
168
+
**SQL query:**
170
169
171
170
```sql
172
171
SELECT*FROM examples
@@ -183,7 +182,7 @@ WHERE cs_ste_vec_v1(encrypted_json) @> cs_ste_vec_v1(
183
182
184
183
This query would return no results, as the value `"d"` is not present in the `"nested"` array.
185
184
186
-
### Field Extraction (`cs_ste_vec_value_v1`)
185
+
### Field extraction (`cs_ste_vec_value_v1`)
187
186
188
187
Extract a field from an encrypted JSONB object.
189
188
@@ -201,7 +200,7 @@ Suppose we have the following encrypted JSONB data:
201
200
202
201
We can extract the value of the `"top"` key.
203
202
204
-
**SQL Query:**
203
+
**SQL query:**
205
204
206
205
```sql
207
206
SELECT cs_ste_vec_value_v1(encrypted_json,
@@ -231,7 +230,7 @@ FROM examples;
231
230
}
232
231
```
233
232
234
-
### Field Comparison (`cs_ste_vec_term_v1`)
233
+
### Field comparison (`cs_ste_vec_term_v1`)
235
234
236
235
Select rows based on a field value in an encrypted JSONB object.
237
236
@@ -247,7 +246,7 @@ Suppose we have encrypted JSONB data with a numeric field:
247
246
248
247
We can query records where the `"num"` field is greater than `2`.
249
248
250
-
**SQL Query:**
249
+
**SQL query:**
251
250
252
251
```sql
253
252
SELECT*FROM examples
@@ -277,7 +276,7 @@ SELECT * FROM examples
277
276
WHERE (jsonb_column->>'num')::int>2;
278
277
```
279
278
280
-
### Grouping Data
279
+
### Grouping data
281
280
282
281
Use `cs_ste_vec_term_v1` along with `cs_grouped_value_v1` to group by a field in an encrypted JSONB column.
283
282
@@ -296,7 +295,7 @@ Suppose we have records with a `"color"` field:
296
295
297
296
We can group the data by the `"color"` field and count occurrences.
@@ -336,24 +335,22 @@ GROUP BY jsonb_column->>'color';
336
335
| green | 2 |
337
336
| red | 1 |
338
337
339
-
## Reference
338
+
## EQL Functions for JSONB and `ste_vec`
340
339
341
-
### EQL Functions for JSONB and `ste_vec`
342
-
343
-
-**Index Management**
340
+
-**Index management**
344
341
345
342
-`cs_add_index_v1(table_name text, column_name text, 'ste_vec', 'jsonb', opts jsonb)`: Adds an `ste_vec` index configuration.
346
343
-`opts` must include the `"context"` key.
347
344
348
-
-**Query Functions**
345
+
-**Query functions**
349
346
350
347
-`cs_ste_vec_v1(val jsonb)`: Retrieves the STE vector for JSONB containment queries.
351
348
-`cs_ste_vec_term_v1(val jsonb, epath jsonb)`: Retrieves the encrypted term associated with an encrypted JSON path.
352
349
-`cs_ste_vec_value_v1(val jsonb, epath jsonb)`: Retrieves the decrypted value associated with an encrypted JSON path.
353
350
-`cs_ste_vec_terms_v1(val jsonb, epath jsonb)`: Retrieves an array of encrypted terms for elements in an array at the given JSON path (used for comparisons).
354
351
-`cs_grouped_value_v1(val jsonb)`: Used with `ste_vec` indexes for grouping.
355
352
356
-
###EJSON Paths
353
+
## EJSON paths
357
354
358
355
EQL uses an extended JSONPath syntax called EJSONPath for specifying paths in JSONB data.
359
356
@@ -363,7 +360,7 @@ EQL uses an extended JSONPath syntax called EJSONPath for specifying paths in JS
363
360
- Wildcards are supported: `$.some_array_field[*]`
364
361
- Array indexing is **not** supported: `$.some_array_field[0]`
365
362
366
-
**Example Paths:**
363
+
**Example paths:**
367
364
368
365
-`$.top.nested` selects the `"nested"` key within the `"top"` object.
369
366
-`$.array[*]` selects all elements in the `"array"` array.
0 commit comments