Couchbase FTS type mapping

For FTS to work, is it required that my document will need to have a type field always. How does FTS work if I do not have a type field in my document

For FTS to work, is it required that my document will need to have a type field always.

Of course not.

How does FTS work if I do not have a type field in my document

The “Type field” setting or any other chosen type identifier will be ignored if you have the default type mapping enabled in the “Type Mappings” section - you will be able to index whatever you choose to from your documents.

The 3 type identifiers are a way to filter what documents your FTS index should index.

  • JSON type field - you can choose any field of your JSON document for this (that has a string value). The type mapping you’ll want to introduce is a value of that chosen field - for which a subset of your documents could qualify.
  • Doc ID up to separator - you could specify a delimiter here and set the type mapping as a string that precedes the delimiter for which a subset of your document IDs could qualify.
  • Doc ID with regex - you could specify a regular expression here that could match a subset of your document IDs.

There’s documentation to assist with creating indexes here - Creating Search Indexes | Couchbase Docs

1 Like