Patch operation types

Each operation in your patch specifies how to modify the targeted path. Bloomreach supports three operation types.

add

Creates the target if it doesn't exist at the top level (for example, a new product). Replaces the target completely if it already exists, removing any existing data under that path.json```json

{
  "op": "add",
  "path": "/product-123",
  "value": {
    "fields": {
      "title": "Laptop",
      "price": 999.99
    }
  }
}

upsert

Creates the target and any missing parent containers if they don't exist. Merges the provided data with existing data if the target already exists. For example, upserting to a fields container adds new fields without removing existing ones.

{
  "op": "upsert",
  "path": "/product-123/fields",
  "value": {
    "brand": "TechPro",
    "warranty": "2 years"
  }
}

remove

Deletes the target if it exists. Produces no error if the target doesn't exist. You can remove entire products, specific variants, or individual fields.

{
  "op": "remove",
  "path": "/product-123/fields/discontinued"
}

Each operation requires an op (operation type) and path (target location). The add and upsert operations also require a value (data to apply), while remove doesn't.