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

    Procedure

    To create a type mapping with the Couchbase Server Web Console:

    1. Go to Search.

    2. Click the index where you want to create a type mapping.

    3. Click Edit.

    4. Expand Customize Index  Mappings.

    5. Click Add Type Mapping.

    6. Do one of the following:

      1. If you selected Use non-default scope/collection(s), in the Collection list, select the collection where you want to create the type mapping.

      2. 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.

    7. (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.

    8. (Optional) To use a specific analyzer for documents in the type mapping, in the Analyzer list, select an analyzer.

    9. (Optional) To switch from a dynamic type mapping to a static type mapping, select Only index specified fields.

      1. To choose which fields to add or remove from the static type mapping, see Create a Child Field.

      2. To add a child mapping for a document field that contains a JSON object, see Create a Child Mapping.

    10. (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.

    11. 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.