Navigate & Query Topic Data

When navigating to a Kafka topic, you can query all existing data and the live stream. Lenses immediately presents a snapshot of the latest data in table browsing mode allowing:

  1. To Filter by timestamp, offset or partition.
  2. To Drill into the data and expand the key and value payloads and any nested fields.
  3. To Work with any data type to Query, Insert, Delete.
  1. From the Header Bar Menu, go to the Dashboard panel
  2. On the side navigation, select Explore under Data section.
  3. Make sure that your Kafka connection is selected on the connection filter

Topics

  1. Select the topic you are interested in
  2. Select the Data tab

Topics

Query data

Data record inspection can be done via the quick filter or SQL editor. The result set is available in 2 different formats: Tree and Grid view. You can switch views from the right-hand icons.

Topic data grid

Quick filtering

The quick filter provides an interactive way to filter data. Available filters include partitions, start offset or timestamp and limiting records returned.

Topic data

SQL filtering

Switch to the SQL editor to run queries by selecting SQL.

See Docs about SQL syntax

Query a live stream

Switch to live continuous query mode by selecting Live Sample.

Topic data

Insert data

  1. From the Explore Menu, select a particular topic.
  2. Click on the Actions menu on the top right of your screen
  3. Select Insert Messages.

Action Menu

If you select to auto generate, Lenses will use the known schema of the key and the value, and synthetically generate an insert statement for you.

Autogenerated Record

Insert using SQL

If you want to automate or make repeatable the insertion of new messages in Kafka topics, use the INSERT INTO SQL statement. Example:

INSERT INTO customer (_key, id, address.line, address.city, address.postcode, email)
VALUES ('david.green', 'david.green', '4309 S Morgan St', 'Chicago', 60609, 'david.green@lenses.io');

See Docs for SQL INSERT INTO

Delete data

Deleting data from topics is supported by removing all messages from a partition up to a specific offset. The deletion of messages on compacted topics is also supported.

To delete data records from a topic:

  1. From the Explore Menu, select a particular topic.
  2. Click on the Actions menu on the top right of your screen
  3. Select Delete Messages.

Action Menu

Select messages to remove

Currently, you can select a particular partition and drop all messages from its beginning to a specific offset.

Delete Records button

Delete using SQL

Use DELETE SQL statement to remove records from the topic.

Example:

DELETE FROM customer WHERE _meta.offset <=10

See Docs for SQL DELETE