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.
Alternatively, you can perform this action from the Coveo Administration Console. See Manage source mappings for details.
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. -
Replace
<MySourceId>
with the ID of the target source.
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
.
|
Note
Setting the |
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 Create an API key for details.
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 for details. -
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 for details.
-
A successful response (200 OK
) contains information about the new mapping configuration.
|
Note
A unique alphanumeric |
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...
]
}