> For the complete documentation index, see [llms.txt](https://developer.emporix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.emporix.io/ce/system-management/search/search-configuration.md).

# Search Configuration with Webhooks

You can integrate the Emporix Commerce Engine with any index providers by leveraging the webhook events concept. Emporix CE recognizes all changes around a product item like the product itself, its price, category or availability related to the product. If any of the connected entities is modified, our platform prepares an index-item object which contains all the necessary data.

<details>

<summary>See the event schema for an updated index item - <code>IndexItemUpdated</code>.</summary>

```json
"id": "String",
"code" : "String",
"siteCode" : "String",
"name" : "Map<String,String>", // Localized map
"description" : "Map<String, String>", // Localized map
"categoryAssignments" : [
  {
    "id" : "String",
    "code" : "String",
    "name" : "String",
    "localizedName" : "Map<String,String>", // Localized map
    "localizedSlug" : "Map<String,String>", // Localized map
    "parent" : "Object"
  }
],
"tags" : String[], // Array of strings
"popularity" : "Integer",
"prices" : [
  {
    "id" : "String",
    "itemId" : {
      "id" : "String",
      "itemType" : "String" // PRODUCT
    },
    "currency" : "String",
    "originalAmount" : "Number",
    "effectiveAmount" : "Number",
    "location" : {
      "countryCode" : "String"
    },
    "salePrice" : {
      "discountAmount" : "Double",
      "discountRate" : "Double",
      "description" : "String"
    },
    "priceModelId" : "String",
    "priceModel" : {
      "id" : "String",
      "name" : "Map<String,String>", // Localized map
      "description" : "Map<String,String>", // Localized map
      "includesTax" : "Boolean",
      "measurementUnit" : {
        "quantity" : "Double",
        "unitCode" : "String"
      },
      "tierDefinition" : {
        "tierType" : "String",
        "tiers" : [
          {
            "id" : "String",
            "minQuantity" : {
              "quantity" : "Double",
              "unitCode" : "String"
            }
          }
        ]
      }
    },
    "restrictions" : {
      "validity" : {
        "from" : "String",
        "to" : "String"
      },
      "siteCodes" : "String[]" // Array of strings
    },
    "tierValues" : [
      {
        "id" : "String",
        "priceValue" : "Double"
      }
    ],
    "mixins" : "Map<String,Object>",
    "siteCode" : "String"
  }
],
"medias" : [
  {
      "url" : "String",
      "position" : "Integer",
      "contentType" : "String",
      "customAttributes" : Map<String, Object>
  }
],
"availability" : {
  "id" : "String",
  "stockLevel" : "Double",
  "productId" : "String",
  "site" : "String",
  "available" : "Boolean",
  "popularity" : "Integer",
  "distributionChannel" : "String"
},
"mixins" : "Map<String,Object>",
"published" : "Boolean",
"available" : "Boolean"

```

</details>

<details>

<summary>See an example of the index-item object and what is emitted every time a product is created or updated.</summary>

```json
{
  "availability": {
    "available": false,
    "distributionChannel": "ASSORTMENT",
    "id": "main:643dacfad50d664c58694c2d",
    "popularity": -2147483648,
    "productId": "643dacfad50d664c58694c2d",
    "site": "main",
    "stockLevel": 2313
  },
  "available": false,
  "categoryAssignments": [
    {
      "id": "79eccb8b-b163-4cb9-9528-ed9468b9f740",
      "localizedName": {
        "en": "c1"
      },
      "name": "c1"
    }
  ],
  "code": "Oranges",
  "id": "643dacfad50d664c58694c2d",
  "medias": [
    {
      "contentType": "image/jpeg",
      "customAttributes": {
        "height": 800,
        "name": "oranges.jpeg",
        "sizeKB": 156.7138671875,
        "width": 1200
      },
      "mainImage": false,
      "url": "http://res.cloudinary.com/saas-ag/image/upload/v1681763617/lsindexdbstage/media/643dad208fc03d22f4e857e6"
    }
  ],
  "popularity": -2147483648,
  "prices": [
    {
      "currency": "EUR",
      "effectiveAmount": 1.55,
      "id": "643dad10c0dc2925289a6206",
      "itemId": {
        "id": "643dacfad50d664c58694c2d",
        "itemType": "PRODUCT",
        "name": {
          "en": "Oranges"
        }
      },
      "location": {
        "countryCode": "DE"
      },
      "originalAmount": 1.55,
      "priceModel": {
        "description": {
          "en": "Default price model"
        },
        "id": "63402c86af907617bb4e1234",
        "includesTax": false,
        "measurementUnit": {
          "quantity": 1,
          "unitCode": "pc"
        },
        "name": {
          "en": "Default price model"
        },
        "tierDefinition": {
          "tierType": "BASIC",
          "tiers": [
            {
              "id": "63402c86af907617bb4e9826",
              "minQuantity": {
                "quantity": 0,
                "unitCode": "pc"
              }
            }
          ]
        }
      },
      "priceModelId": "63402c86af907617bb4e1234",
      "restrictions": {
        "siteCodes": [
          "main"
        ]
      },
      "siteCode": "main",
      "tierValues": [
        {
          "id": "63402c86af907617bb4e9826",
          "priceValue": 1.55
        }
      ]
    }
  ],
  "published": true,
  "siteCode": "main",
  "tags": [
    "product",
    "published"
  ]
}

```

</details>

<details>

<summary>See the event schema for a deleted index item - <code>IndexItemDeleted</code>.</summary>

```json

"id": "String",
"siteCode" : "String"

```

</details>

<details>

<summary>See an example message that is sent when a product is deleted.</summary>

```json
{
  "id": "643dab38a9e0f24d6bda45ee",
  "siteCode": "main"
}

```

</details>

The index-item payloads above are produced inside Commerce Engine whenever catalog data changes, but they do not reach your search provider on their own. The **Webhook Service** is the delivery layer: it forwards **Index item updated** and **Index item deleted** events to the endpoint you configure (for example by using Svix), where they can be transformed and applied to your external search index.

Without enabling the webhook service and the index-item events, your search engine has no automated way to learn about new, changed, or removed products.

## Enabling webhook service

To enable the webhook service, follow these steps:

{% stepper %}
{% step %}

#### Open Webhooks

Log in to the Management Dashboard and go to **Administration** -> **Webhooks**.
{% endstep %}

{% step %}

#### Choose a webhook strategy

Choose the webhooks strategy that best suits your needs. You can select between HTTP, SVIX and SVIX SHARED.

<figure><img src="/files/jcG78YYbe9hshYjW4z6y" alt="Webhook strategy selection in Management Dashboard"><figcaption><p>Webhook strategy selection in Management Dashboard</p></figcaption></figure>

{% hint style="info" %}
For more information on webhooks strategies and configuration, see [Webhooks](/ce/management-dashboard/administration/webhooks.md).
{% endhint %}
{% endstep %}

{% step %}

#### Enable index-item events

Extend the **Index item** webhook details and enable the **Index item updated** and the **Index item deleted** events.

<figure><img src="/files/S7gWY5kZKnaoxmV7ODTx" alt="Index item updated and deleted events enabled in Webhooks"><figcaption><p>Index item updated and deleted events enabled in Webhooks</p></figcaption></figure>
{% endstep %}

{% step %}

#### Configure endpoints

Depending on the chosen webhook strategy, there are different ways to configure the endpoints for receiving notifications about events happening in the system. Configure your strategy to be able to process the events.
{% endstep %}
{% endstepper %}

Commerce Engine allows you to configure your own search functionality. You can choose any provider that suits your needs. For demonstration purposes of how you can configure search through the webhooks functionality, we present examples of configuring [Algolia](https://www.algolia.com/) and [BatteryIncluded](https://batteryincluded.ai/en/). These are the search engines that can be configured to work with Emporix CE and Svix.

<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th align="center"></th><th align="center"></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><i class="fa-magnifying-glass">:magnifying-glass:</i></td><td align="center"><strong>Algolia Search Provider</strong></td><td align="center">Set up Algolia webhook endpoints, transformations, and indexing strategy outputs.</td><td></td><td></td><td><a href="/pages/FWq2sumB8Ep73ic0jGiY">/pages/FWq2sumB8Ep73ic0jGiY</a></td></tr><tr><td align="center"><i class="fa-battery-full">:battery-full:</i></td><td align="center"><strong>BatteryIncluded Search Provider</strong></td><td align="center">Configure BatteryIncluded webhook and native indexing service options in one place.</td><td></td><td></td><td><a href="/pages/Q5vDLD8zroJ3I6atBO6L">/pages/Q5vDLD8zroJ3I6atBO6L</a></td></tr></tbody></table>

### Webhook configuration example with Svix-shared strategy

For Svix-shared strategy, use the **Open Svix Dashboard** option to configure the relevant endpoints. It automatically opens the Svix Dashboard where you can configure the required endpoints. See the testing example below:

{% stepper %}
{% step %}

#### Add an endpoint

In Svix Dashboard, go to **Endpoints** and choose the **Add Endpoint** button to start the endpoint configuration.

For testing purposes, you can use **Svix Play** configuration, it automatically creates a sandbox destination.

<figure><img src="/files/5fehy4FzX9WBIq3DcVl7" alt="Svix endpoint URL configuration"><figcaption><p>Svix endpoint URL configuration</p></figcaption></figure>
{% endstep %}

{% step %}

#### Filter index-item events

In the **Message Filtering** section, choose the **index-item** events:

* `index-item.deleted`
* `index-item.updated`

<figure><img src="/files/1CDXBam7xD1736ZgO7rd" alt="Svix message filtering for index-item events"><figcaption><p>Svix message filtering for index-item events</p></figcaption></figure>
{% endstep %}

{% step %}

#### Save the endpoint

Save your endpoint configuration by choosing the **Create** button.
{% endstep %}

{% step %}

#### Test the configuration

Go back to the Emporix Management Dashboard and add a new product.\
After a few minutes, you should see the updated delivery statistics in Svix.

<figure><img src="/files/IOLVBFAQxTeKTx15NZg8" alt="Svix delivery statistics after sending a test event"><figcaption><p>Svix delivery statistics after sending a test event</p></figcaption></figure>
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.emporix.io/ce/system-management/search/search-configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
