Skip to main content

Typesense

The Enterspeed Typesense integration uses the destinations field to send data from views directly to a configured Typesense cluster. This means that you can decide on schema level which views you want to send to Typesense.

You will only have to set the destination field on the entity schema you want to send to Typesenses. All schema references are automatically resolved so you don't have to set it on all referenced schemas.

It's possible to configure multiple Typesense destinations if you need to push different types of data to different Typesense clusters.

Configuration

In order to setup the Typesense configuration you need the following:

SettingDescription
Typesense Server URLThe Server URL for the Typesense cluster you want to integrate to
Typesense API KeyA Typesense Admin API key
Enterspeed Environment Client API KeyThe API key for an Enterspeed Environment client. This is used to fetch the view that will be inserted into Typesense

Schema options

On Enterspeed schema level you have the following options:

OptionRequiredDescription
collectionRequiredThe Typesense collection the data should be send to
idOptionalThe value that should be used as id in for the Typesense document. If omitted, the Enterspeed view id will be used
dirtyValuesOptionalDefines what Typesense should do when the type of a particular field being indexed does not match the Typesense schema.

Valid values are: coerce_or_reject (default), coerce_or_drop, drop, reject

Refer to the Typesense documentation for more information

Example of usage

Content schema with Typesense destination
/** @type {Enterspeed.FullSchema} */
export default {
triggers: function(context) {
context.triggers('cms', ['content']);
},
actions: function (sourceEntity, context) {
context.destination('typesense').options({
id: sourceEntity.originId,
collection: 'content'
dirtyValues: 'coerce_or_reject'
});
},
properties: function ({properties: p, url}, context) {
return {
product: {
url: url,
title: p.title,
content: p.text
}
}
}