Managing the Mapping Configuration of a Source

The mapping configuration of a source may include any number of mappings. Each mapping may contain one or more rules that are evaluated sequentially when the Coveo Cloud indexing pipeline processes an incoming item in that source to determine how to use its metadata to populate fields in the index. Each individual mapping can apply to all incoming items in a source, or only to a specific item type.

Use the Update mapping configuration operation to manage the mapping configuration of a specific source in a Coveo Cloud organization.

You can also perform this action from the Coveo Cloud Administration Console (see Adding and Managing Source Mappings).

Request template

PUT https://platform.cloud.coveo.com/rest/organizations/<MyOrganizationId>/sources/<MySourceId>/mappings?rebuild=<true|false> HTTP/1.1
 
Content-Type: application/json
Accept: application/json
Authorization: Bearer <MyAccessToken>

Payload

{
  "common": {
    "rules": [
      <MyCommonMappingRule>*
    ]
  },
  "types": [
    {
      "rules": [
        <MyTypeSpecificMappingRule>*
      ],
      "type": <MyItemType>
    }*
  ]
}

In the request path:

In the request query string:

  • Set the rebuild parameter to true if you want to rebuild your source after the mapping configuration is successfully updated. Otherwise, set it to false.

    Setting the rebuild parameter to true has no effect if the target source is a Push source managed by custom external code.

In the Authorization HTTP header:

In the request body:

  • In the common property, in the rules array, for each mapping you want to evaluate when processing an incoming item in the target source (regardless of its type), replace <MyCommonMappingRule>* with a valid mapping definition (see Mapping Definition Examples).

  • In the types array, for each type of item for which you want to specify a mapping:

    • In the rules array, replace <MyTypeSpecificMappingRule>* with one or more valid mapping definitions.

      Replace <MyItemType> with the objecttype, mappingtype, documenttype, or filetype standard metadata value an incoming item must match for the type-specific mappings to be evaluated for this item (see Source Item Types).

A successful response (200 OK) contains information about the new mapping configuration.

A unique alphanumeric id is automatically assigned to each mapping and type. You can later refer to these identifiers to modify specific aspects of a source mapping configuration.

Defining the entire mapping configuration of a source

PUT https://platform.cloud.coveo.com/rest/organizations/mycoveocloudv2organizationg8tp8wu3/sources/mycoveocloudv2organizationg8tp8wu3-rp5rxzbdz753uhndklv2ztkfgy/mappings?rebuild=false HTTP/1.1
 
Content-Type: application/json
Accept: application/json
Authorization: Bearer **********-****-****-****-************

Payload

{
  "common": {
    "rules": [
      {
        "content": [
          "%[productname]"
        ],
        "field": "product"
      },
      // ...More common mappings...
    ]
  },
  "types": [
    {
      "rules": [
        {
          "content": [
            "%[dominantcolorshade]",
            " ",
            "%[dominantcolorname]"
          ],
          "field": "dominantcolor"
        },
        // ...More type-specific mappings...
      ],
      "type": "Image"
    },
    // ...More item type definitions...
  ]
}

200 OK response body

{
  "common": {
    "rules": [
      {
        "content": [
          "%[productname]"
        ],
        "field": "product",
        "id": "tmc7uozasfgjae554xyvdjkkxu"
      },
      // ...More common mappings...
    ]
  },
  "types": [
    {
      "rules": [
        {
          "content": [
            "%[dominantcolorshade]",
            " ",
            "%[dominantcolorname]"
          ],
          "field": "dominantcolor",
          "id": "v25gsykuqp7g5wdenx6isikkei"
        },
        // ...More type-specific mappings...
      ],
      "type": "Image",
      "id": "Image"
    },
    // ...More item type definitions...
  ]
}
Recommended Articles