Manage the Mapping Configuration of a Source
Manage 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 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 organization.
You can also perform this action from the Coveo Administration Console (see Manage 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:
-
Replace
<MyOrganizationId>
with the ID of the target Coveo organization (see Retrieve the organization ID). -
Replace
<MySourceId>
with the ID of the target source.
In the request query string:
-
Set the
rebuild
parameter totrue
if you want to rebuild your source after the mapping configuration is successfully updated. Otherwise, set it tofalse
.Setting the
rebuild
parameter totrue
has no effect if the target source is a Push source managed by custom external code.
In the Authorization
HTTP header:
- Replace
<MyAccessToken>
with an access token that grants the privilege to edit sources (that is, the Edit access level on the Sources domain) in the target Coveo organization (see Add an API key).
In the request body:
-
In the
common
property, in therules
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 theobjecttype
,mappingtype
,documenttype
, orfiletype
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...
]
}