Skip to content

Databases

Typesense Search Engine Management in VS Code

Typesense is an open-source search engine that stores JSON documents in collections and returns typo-tolerant results as you type. You work with it over an HTTP API, and each collection has a schema that lists its fields and their types.

To connect to Typesense in DBCode:

  1. Open the DBCode Extension: Launch Visual Studio Code and open the DBCode extension.
  2. Add a New Connection: Click on the “Add Connection” icon.
  3. Complete connection form: Select Typesense as the database type and enter:
    • Host and port (default 8108)
    • SSL/TLS settings (if required)
    • An API key: an admin key, or a key with the actions you need. You can also select a Command authentication profile instead of storing the key directly. A key with the documents:search and collections:list actions can browse and search collections, and the admin folders show empty.
  4. Connect: Click save to establish your connection.
  5. Start Managing Your Data: Browse collections, documents, and the admin folders.

For Typesense Cloud, use your cluster’s host name, port 443, and turn SSL on.

For detailed instructions on connecting, refer to the Connect article.

  • Collections as tables: Each collection appears as a table. Open one to page through its documents in the grid.
  • Filtering: Filter in the grid with equals, not equal, and starts with. Equals and starts with ignore upper and lower case and punctuation, as Typesense matches text. Starts with matches the start of the whole value, or of any element in a list field. Greater than and less than work on number fields. A filter value can’t contain a backtick (`), and DBCode tells you when one does. Contains, ends with, and empty-value filters are not available in Typesense, and DBCode tells you so when you apply one.
  • Sorting: Sort in the grid on sortable fields. Number fields are sortable by default; other fields need "sort": true in the collection schema.
  • Editing: Insert, update, and delete documents in the grid. Documents are matched by their id, which Typesense always stores as a string. The id cannot be changed afterwards (DBCode refuses the change when you save).
  • Truncate and drop: Right-click a collection to remove all of its documents with Truncate, or delete the collection with Drop.

The query editor runs JSON search statements. Every key except collection is passed to Typesense as a search parameter:

{ "collection": "products", "q": "shoe", "query_by": "title" }

Use "q": "*" to match every document without query_by. If a search sets no limit, DBCode applies your usual row limit. A grouped search (group_by) shows one row per hit, with the hit’s group key in a group_key column. Results in the editor are read-only; to edit documents, open the collection in the grid.

A statement with a fields array changes the collection’s schema. Add a field with its name and type, or drop one with "drop": true:

{ "collection": "products", "fields": [{ "name": "rating", "type": "float" }] }
{ "collection": "products", "fields": [{ "name": "rating", "drop": true }] }

DBCode waits for the change to finish before showing the result. If you stop the query while it waits, the change carries on in Typesense.

Right-click a collection and choose Script > CREATE (DDL) to see its current schema as comments, followed by a fields statement ready for the fields you want to add or drop.

Each connection shows these folders next to the collections. Their items are read-only, and Script opens an item’s definition as JSON.

  • Aliases, Presets, and Stopwords.
  • Keys: API keys, listed by description. Only the first 4 characters of each key are shown.
  • Synonym Sets and Curation Sets: on Typesense 30 and later, these are top-level folders. On earlier versions, each collection shows its own Synonyms and Overrides folders instead, when it has any.
  • Monitoring: See server resources (CPU, memory, and disk), request rates and latency, and any schema changes in progress.
  • Read-only connections: Mark a connection read-only to block every write, including document edits and field changes, while still allowing searches and browsing.

By using Typesense with DBCode, you can manage your search collections directly within Visual Studio Code.

For more information about Typesense, check out Typesense.