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’ve created an index. For more information, see Create a Basic Search Index with the Web Console.
-
You’ve 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, in the # field, add the document type to the end of the collection.
For example,
scope.collection.document_type
. -
(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.
-
-
(Optional) To add a child type mapping for a document field that contains a JSON object, see Create a Child Mapping.
-
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.