@@ -285,6 +285,57 @@ WHERE cs_ste_vec_term_v1(examples.encrypted_jsonb, $1) > cs_ste_vec_term_v1($2)
285
285
}
286
286
```
287
287
288
+ ## ` @> ` and ` <@ `
289
+
290
+ ### Native Postgres JSON(B)
291
+
292
+ ``` sql
293
+ -- Checks if the left arg contains the right arg (returns `true` in this example).
294
+ SELECT ' {"a":1, "b":2}' ::jsonb @> ' {"b":2}' ::jsonb;
295
+
296
+ -- Checks if the right arg contains the left arg (returns `true` in this example).
297
+ SELECT ' {"b":2}' ::jsonb < @ ' {"a":1, "b":2}' ::jsonb;
298
+ ```
299
+
300
+ ### EQL
301
+
302
+ EQL uses the same operators for containment (` @> ` and ` <@ ` ) queries, but the args need to be wrapped in ` cs_ste_vec_v1 ` .
303
+
304
+ Example query:
305
+
306
+ ``` sql
307
+ -- Checks if the left arg (the `examples.encrypted_jsonb` column) contains the right arg ($1).
308
+ -- Would return `true` for the example data and param below.
309
+ SELECT * WHERE cs_ste_vec_v1(encrypted_jsonb) @> cs_ste_vec_v1($1 ) FROM examples;
310
+
311
+ -- Checks if the the right arg ($1) contains left arg (the `examples.encrypted_jsonb` column).
312
+ -- Would return `false` for the example data and param below.
313
+ SELECT * WHERE cs_ste_vec_v1(encrypted_jsonb) < @ cs_ste_vec_v1($1 ) FROM examples;
314
+ ```
315
+
316
+ Example params:
317
+
318
+ ``` javascript
319
+ // Assume that examples.encrypted_jsonb has JSON objects with the shape:
320
+ {
321
+ " field_a" : {
322
+ " field_b" : [1 , 2 , 3 ]
323
+ }
324
+ }
325
+
326
+ // `$1` is the EQL plaintext payload for the JSON object `{"field_b": [1, 2, 3]}`:
327
+ {
328
+ " k" : " pt" ,
329
+ " p" : " {\" field_b\" : [1, 2, 3]}" ,
330
+ " i" : {
331
+ " t" : " examples" ,
332
+ " c" : " encrypted_jsonb"
333
+ },
334
+ " v" : 1 ,
335
+ " q" : " ste_vec"
336
+ }
337
+ ```
338
+
288
339
## ` json_array_elements ` , ` jsonb_array_elements ` , ` json_array_elements_text ` , and ` jsonb_array_elements_text `
289
340
290
341
### Native Postgres JSON(B)
0 commit comments