Create a New Mapping or Type Mapping

  • Capella Operational
  • how-to
    +
    Create a type mapping with the Couchbase Capella UI to control what documents are included or excluded from a Search index.

    You can create static type mappings, which include only specific fields from your documents, or dynamic type mappings, which include all available fields. For more information about type mappings and mappings in the Search Service, see Type Mappings and Mappings.

    Some mappings are only available in Advanced Mode.

    Prerequisites

    • You have the Search Service enabled on a node in your operational cluster. For more information about how to change Services on your operational cluster, see Modify a Paid Cluster.

    • You have a bucket with scopes and collections in your operational cluster. For more information, see Manage Buckets.

    • You have created a basic Search index with the Capella UI. For more information, see Create a Search Index with the Capella UI.

    • You have logged in to the Couchbase Capella UI.

    Procedure

    To use the Capella UI to create a new type mapping or mapping on a Search index:

    1. On the Operational Clusters page, select the operational cluster where you created your Search index.

    2. Go to Data Tools  Search.

    3. Click the name of the index where you want to create a new type mapping.

    4. If you have not already, create at least 1 collection type mapping.

    5. Do one of the following:

      1. To index all documents from an additional collection, create a collection type mapping.

      2. (Advanced Mode Only) To index Extended Attributes (XATTRs) data from your documents, create an XATTRs mapping.

      3. To index an entire JSON object from your document schema, create a JSON object mapping.

      4. To index a single document field from your document schema, create a field mapping.

      5. (Advanced Mode Only) Index a field or object that does not yet exist in your document schema.

    6. (Optional) To remove all documents that match a type mapping or mapping from your Search index, turn off the mapping.

    7. Click Update Index.

    Add a Collection Type Mapping

    Add a collection type mapping to index all documents from a specific collection in your chosen bucket and scope.

    To add an entire collection as a new type mapping:

    1. In the Choose a Collection or Document Field panel, click a collection name.

    2. Configure your type mapping options.

    3. Click Add To Index.

    Add an XATTRs Mapping

    XATTRs mappings can only be created with Advanced Mode.

    Add an XATTRs mapping to index document metadata from a specific collection.

    To add Extended Attributes (XATTRs) document metadata as a new mapping:

    1. If you have not already, create a collection type mapping for the collection that has documents with XATTRs data.

    2. Under your Configured Type Mappings, next to your collection type mapping, click Add XATTRs.

    3. Configure your mapping options.

    4. Click Add To Index.

    Add a JSON Object Mapping

    Add a JSON object mapping to index a JSON object from your document schema. You can choose to index the fields inside the JSON object as field mappings, or keep your JSON object mapping as a dynamic mapping.

    To add an entire JSON object from your documents as a new mapping:

    1. In the Choose a Collection or Document Field panel, expand a collection.

    2. Inside your displayed document schema, click the name of a JSON object in your documents.

    3. Configure your mapping options.

    4. Click Add To Index.

    Add a Single Document Field Mapping

    Add a single document field mapping to index a single document field from your document schema. Adding document field mappings turns any parent mappings into static type mappings.

    To add only a single field from your documents as a new mapping:

    1. In the Choose a Collection or Document Field panel, expand a collection.

    2. Inside your displayed document schema, click the name of a document field.

    3. configure your type mapping options.

    4. Click Add To Index.

    Add a Mapping or Type Mapping for a Future Object or Field

    Mappings for objects that do not yet exist in your documents can only be created in Advanced Mode.

    You can choose to add a mapping or type mapping for a JSON object or field that does not yet exist in your document schema. If you know the name of the object or field, the Search Service can search these fields after they have been added to the documents in your Search index.

    To add a mapping or type mapping for a future object or field:

    1. Select Enable Advanced Options.

    2. Create a collection type mapping for the collection that will hold the documents with your future field.

    3. Under your Configured Type Mappings, next to your collection type mapping, do one of the following:

      1. To create a new JSON Object, click Add Object.

      2. To create a new field, click Add Field.

    4. In the Property Name field, enter the name of the JSON object or field.

    5. Configure your object mapping or field type mapping options.

    6. Click Add To Index.

    Turn a Mapping On or Off

    You can turn off a type mapping or mapping to remove any documents that match that type mapping from your Search index. These documents will not appear in search results when you run a query on the index. Turning off mappings is useful for troubleshooting Search index configurations, without losing configuration settings.

    To turn off a mapping or type mapping in your Search index:

    1. Under Configured Type Mappings, find the type mapping or mapping you want to turn off.

    2. Clear the checkbox for the type mapping or mapping.

    You can select a type mapping or mapping again at any time to add it back to your Search index and search results.

    Next Steps

    Your Search index will contain any documents, objects, or fields that you specify in your type mappings and mappings.

    You can keep adding additional features to your Search index to improve performance and search results. For more information, see Search Index Features.

    For more information about how to run a search, see Run A Simple Search with the Capella UI.