Recipes for searching JSON documents
This section contains ready-made recipes for using JSON indexes to efficiently select data based on the contents of columns of type Json and JsonDocument.
The recipes are built around the JSON_EXISTS and JSON_VALUE functions with JsonPath expressions. To guarantee index usage, all examples use explicit access via VIEW IndexName.
- JSON index – quick start — minimal scenario: creating a table, an index, inserting data, and basic queries.
- Catalog with nested attributes — example of a product catalog with nested attributes, range conditions, and searching nested arrays.
- Parameterized queries and JsonPath variables — parameterized queries and passing variables to JsonPath via the
PASSINGsection. - Checking field type and path existence — checking the field type and path existence using JsonPath methods.
Before running the examples, make sure that JSON index support is enabled on the cluster.