Step 4. Display the KV Store collection using a lookup

In this step, you'll use a search command with a lookup to view the contents of the "mycollection" KV Store collection.

To use a lookup with a KV Store collection, you need to define a lookup in the app's transforms.conf configuration file. You already did that in Step 2. Set up the configuration files for the KV Store.

To display the results of the search, you need to add a table to the dashboard and connect it to a search. You already did that using the Dashboard Editor in Step 1. Create an app with a dashboard and convert it to HTML by adding a Statistics Table for the search string "TBD".

The code is already there, so you just need to update the search string.

  1. The search string provided initially was "TBD". Find it and replace it with a search command that uses inputlookup.
  2. Find this code:

                   "search": "TBD",

    Replace it with this code:

                   "search": " | inputlookup kvstore_lookup | eval  KeyID = _key | table KeyID, CustID, CustName, CustStreet, CustCity, CustState, CustZip",

    For more examples showing how to use lookups, see Use lookups with KV Store data.

  3. Save your changes, refresh the app's views (open http://<localhost:port>/debug/refresh in your web browser and click Refresh), then reload the dashboard (open http://<localhost:port>/app/kvstoretutorial/customer_info_html).
  4. Now when you fill out the form and click the Submit button, the KV Store collection table shows you the contents of the collection.

A simple app that uses the KV Store

Continue to Step 5. Delete records from the KV Store collection.