Prerequisites
To follow the code examples in this guide, you must install Docker locally and download recipes.Navigate to recipe
- If you haven’t already, download recipes.
- In terminal, go to the recipe by running the following command:
Launch Pinot Cluster
You can spin up a Pinot Cluster by running the following command:Data generator
This recipe contains a data generator that creates events with data about people. It uses the Faker library, so you’ll first need to install that:Kafka ingestion
We’re going to ingest this data into an Apache Kafka topic using the kcat command line tool. We’ll also usejq to structure the data in the key:payload structure that Kafka expects:
Pinot Schema and Table
Now let’s create a Pinot Schema and Table. First, the schema:
So we are including all fields except
age in the JSON index.
Fields included in the JSON index can be filtered using the
JSON_MATCH function.
If you use this function with a field that isn’t included in the index, it won’t return any records.Querying by JSON index
Let’s now try to query this table using the JSON index. JSON indexes support the following predicates:=, <>, IN, and NOT IN
State = Kentucky
Query Results
State <\> Kentucky
Query Results
State IN Kentucky or Alabama
Query Results
State NOT IN Kentucky or Alabama
Query Results
Unindexed field
What if we try to query by theage column, which hasn’t been indexed?
Query Results
We get back no results! We can even run the following query to confirm that the table contains records with an age of 59:
Query Results

