Create a Type Mapping
- how-to
Create a type mapping with the Couchbase Server Web Console to control what documents are included or excluded from a Search index. For more information, see Customize a Search Index with the Web Console.
Prerequisites
-
You have the Search Service enabled on a node in your database. For more information about how to deploy a new node and Services on your database, see Manage Nodes and Clusters.
-
You have created an index. For more information, see Create a Basic Search Index with the Web Console.
-
You have logged in to the Couchbase Server Web Console.
Procedure
To create a type mapping with the Couchbase Server Web Console:
-
Go to Search.
-
Click the index where you want to create a type mapping.
-
Click Edit.
-
Expand
. -
Click Add Type Mapping.
-
Do one of the following:
-
If you selected Use non-default scope/collection(s), in the Collection list, select the collection where you want to create the type mapping.
-
If you cleared Use non-default scope/collection(s), in the # field, enter the name of a type field where you want to create a type mapping.
-
-
(Optional) To only include documents of a specific type from a collection, add the document type to the end of the collection in the # field.
For example,
scope.collection.document_type
. For more information, see Set the Type Identifier for a Search Index. -
(Optional) To use a specific analyzer for documents in the type mapping, in the Analyzer list, select an analyzer.
You can use a default analyzer or create your own.
-
(Optional) To switch from a dynamic type mapping to a static type mapping, select Only index specified fields.
-
To choose which fields to add or remove from the static type mapping, see Create a Child Field.
-
To add a child mapping for a document field that contains a JSON object, see Create a Child Mapping.
-
-
(Optional) To remove all documents that match the type mapping from your Search index, clear the checkbox for that type mapping.
By leaving the checkbox selected, all matching documents will be included in the Search index.
-
Click OK.
Next Steps
After you create a static type mapping, you can Create a Child Field to add or remove specific document fields from your Search index.
To add an extra filter to the documents selected by your type mapping, you can also Set the Type Identifier for a Search Index.
If you have a document field that contains a JSON object, Create a Child Mapping for that field.
To continue customizing your Search index, you can:
To run a search and test the contents of your Search index, see Run A Simple Search with the Web Console or Run a Simple Search with the REST API and curl/HTTP.