Enable Image Search with PIM
4 min
To enable Image Search in your index, you must create a product template with a special attribute.
This product template does not need to be used in your products it is just to enable the image search feature.
Create an Attribute with the Next KNN Search Properties and Name
curl --location 'https://api.upstartcommerce.com/pim/attributes' \
--header 'x-upstart-tenant: TENANT_ID' \
--header 'x-upstart-site:SITE_ID' \
--header 'Content-Type: application/json' \
--header 'x-upstart-api-key: API_KEY' \
--data '{
"name": "media_url",
"typeName": "String",
"adminDisplayConfiguration": {
"adminDisplayName": {
"localizations": {
"en_us": "attribute for image search"
}
},
"displayGroup": "string",
"inputType": "text",
"helperText": {
"localizations": {
"en_us": "attribute for image search"
}
}
},
"displayName": {
"localizations": {
"en_us": "attribute for image search"
}
},
"description": {
"localizations": {
"en_us": "attribute for image search"
}
},
"searchProperties": {
"knnVectorSupported": true,
"indexed": false,
"knnVectorEmbeddings": {
"image_model": {
"dimension": 768,
"method": {
"name": "hnsw",
"space_type": "l2",
"engine": "faiss"
}
}
}
},
"multiValued": false,
"priority": 0,
"scope": "PRODUCT",
"isRequired": false,
"draft": true
}'Commit the Attribute
curl --location 'https://api.upstartcommerce.com/pim/batch/attributes/change-status' \
--header 'x-upstart-tenant: TENANT_ID' \
--header 'x-upstart-site: SITE_ID' \
--header 'Content-Type: application/json' \
--header 'x-upstart-api-key: API_KEY' \
--data '[
{
"id": "ATTRIBUTE_ID",
"status": "COMMIT"
}
]' Create the Product Template with the Attribute and Publish
The detailed steps to create a Product Template can be viewed on How to Create Product Templates.
- Go to your UpStart Commerce Portal.
- Click on Create Template.
- Add a name and description to the product template (for example: To Enable Image Search).
- Select the product type.
- Click on Create & Open, search for the image search attribute and add it to the Product Template.
- Click on Publish.
- Reach out to UpStart Commerce team to reindex your catalog indexes to fully enable image search.