> 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/api-documentation/api-guides/configuration/indexing-service/indexing.md).

# Indexing Tutorial

The Indexing service is designed to manage indexing configuration. Currently supported index providers:

* [Algolia](https://www.algolia.com)
* [BatteryIncluded](https://www.batteryincluded.io)

Proper indexing allows you to enhance your search mechanism within the Emporix system. By connecting an index provider to Commerce Engine, you get improved search functionality.

{% hint style="info" %}
To learn more about the Indexing Service, see the [Indexing Service](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service.md).
{% endhint %}

#### Provider mutual exclusivity

Only one provider can be active at a time per tenant. This constraint is enforced by the configuration service.

#### BatteryIncluded limitations

BatteryIncluded only supports the `MERGE` site-aware fields strategy. Tenants configured with the `SPLIT` strategy will have BatteryIncluded indexing silently skipped. To set the strategy, see [How to choose indexing strategy](#how-to-choose-indexing-strategy).

{% hint style="info" %}
For details on how BatteryIncluded builds product documents under `MERGE`, including behavior when the default site is or is not `main`, see [How BatteryIncluded indexes products](#how-batteryincluded-indexes-products).
{% endhint %}

#### Write-key validation

When you create or update a `BATTERY_INCLUDED` configuration, the indexing service validates `indexName` and `writeKey` against the host in `apiUrl`, or against the default BatteryIncluded host when `apiUrl` is not set, before saving. Invalid credentials return `400`. If credential validation is temporarily unavailable, the request returns `502`. In both cases, the configuration is left unchanged. For details, see [How to set the BatteryIncluded API URL](#how-to-set-the-batteryincluded-api-url).

Starting a product reindex while `BATTERY_INCLUDED` is active runs the same check against stored credentials before a reindex job is created.

#### Algolia limitations

By default, Algolia indexes provided by Emporix support records up to 10kB in size. In order to support larger records, you must provide your own Algolia service. For more information, please refer to documents provided by Algolia:

* [Algolia documentation](https://www.algolia.com/doc/guides/scaling/algolia-service-limits#application-record-and-index-limits)
* [Algolia FAQ](https://support.algolia.com/hc/en-us/articles/4406981897617-Is-there-a-size-limit-for-my-index-records)

For every tenant, new Algolia credentials are created and kept as `AlgoliaClient`.

The Indexing service uses separate API keys for every tenant, so that you get more flexibility in configuration.

## How to choose indexing strategy

You can choose between two indexing strategies for your search index configuration: `MERGE` and `SPLIT`. `MERGE` strategy creates a single index for all sites declared in the system, while `SPLIT` creates a separate index for each site.

BatteryIncluded supports only `MERGE`. If the strategy is `SPLIT`, BatteryIncluded product indexing is skipped.

{% hint style="info" %}
For details on how BatteryIncluded indexes products under `MERGE`, see [How BatteryIncluded indexes products](#how-batteryincluded-indexes-products).
{% endhint %}

To choose the right mode for your index, send the request to the [Updating a configuration](https://developer.emporix.io/api-documentation/api-guides/configuration/configuration-service/api-reference/tenant-configurations#put-configuration-tenant-configurations-propertykey) endpoint. The request requires an OAuth2 service token with the `configuration.configuration_manage` scope.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

{% content-ref url="/pages/aTS8lNwa5Md5mfhYi6Kc" %}
[API Reference](https://developer.emporix.io/api-documentation/api-guides/configuration/configuration-service/api-reference.md)
{% endcontent-ref %}

```bash
curl -i -X PUT \
  'https://api.emporix.io/configuration/{tenant}/configurations/{propertyKey}' \
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "key": "indexing_siteAwareFieldsStrategy",
    "secured": false,
    "value": {
      "strategy": "SPLIT"
    },
    "version": 1
  }'
```

In the request parameters, for the `propertyKey` choose `indexing_siteAwareFieldsStrategy`. In the request body, pass the chosen strategy value. Please remain patient as propagating changes to the index strategy may take up to 1 hour, so you might not be able to see the changes instantly.

After you set the strategy, create the indexing configuration. See [How to configure search indexing](#how-to-configure-search-indexing).

## How to configure search indexing

To create indexing configuration, send a request to the [Creating new configuration](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#post-indexing-tenant-configurations) endpoint.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

{% content-ref url="/pages/MjD2ceBtWNWeQyEaK3eA" %}
[API Reference](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference.md)
{% endcontent-ref %}

```bash
curl -L 
  --request POST 
  --url 'https://api.emporix.io/indexing/{tenant}/configurations' 
  --header 'Content-Type: application/json' 
  --data '{
    "active": true,
    "searchKey": "84dc4886f81f805c42bdd89d64de751a",
    "applicationId": "8AP2HABA2I",
    "indexName": "exampleTenant",
    "writeKey": "51ebe89215dddcf85e5dacd5643d17e7",
    "provider": "ALGOLIA"
  }'
```

For the `BATTERY_INCLUDED` provider, the same configuration endpoints also support mixin filtering options:

* `excludedMixinKeys` - optional list of top-level mixin keys to exclude
* `includedMixinPaths` - optional list of glob patterns that allowlist mixin paths

{% hint style="info" %}
The `BATTERY_INCLUDED` configuration also accepts `apiUrl`, `enrichments`, and `siteAwareMixinsStrategy`. See [How to set the BatteryIncluded API URL](#how-to-set-the-batteryincluded-api-url), [How to choose the data that BatteryIncluded indexing uses](#how-to-choose-the-data-that-batteryincluded-indexing-uses), and [How to choose site-aware mixins indexing for BatteryIncluded](#how-to-choose-site-aware-mixins-indexing-for-batteryincluded).
{% endhint %}

The `includedMixinPaths` option is matched against full dot-notation mixin paths rooted at the mixin key, for example `class_EA673_toolsClassification.sk.OnlineIsService_P`.

Supported glob syntax:

* `*` matches any characters within a single path segment
* `**` matches across one or more path segments
* `.` separates path segments

Matching is case sensitive and uses full-path matching. If a matched path points to an object, the whole subtree under that object is included.

Behavior:

* if `includedMixinPaths` is absent or an empty list (`[]`), allowlist filtering is inactive
* if `includedMixinPaths` is non-empty, only matching mixin paths are sent to BatteryIncluded
* `includedMixinPaths` and `excludedMixinKeys` must not both be non-empty in the same request
* malformed glob patterns are rejected with a `400` validation error on configuration writes

Example of the BatteryIncluded configuration:

```bash
curl -L \
  --request POST \
  --url 'https://api.emporix.io/indexing/{tenant}/configurations' \
  --header 'Content-Type: application/json' \
  --data '{
    "active": true,
    "indexName": "exampleTenant",
    "writeKey": "51ebe89215dddcf85e5dacd5643d17e7",
    "provider": "BATTERY_INCLUDED",
    "includedMixinPaths": [
      "*_siteAware.*.OnlineIsService_P",
      "*_siteAware.**"
    ]
  }'
```

If `writeKey` or `indexName` is wrong, the create request fails with `400` and nothing is stored. Fix the credentials in BatteryIncluded and retry.

## How to update the index configuration

To update the index configuration you need to retrieve the `writeKey` first. Send the request to the [Get configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#get-indexing-tenant-configurations-provider) endpoint.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

{% content-ref url="/pages/MjD2ceBtWNWeQyEaK3eA" %}
[API Reference](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference.md)
{% endcontent-ref %}

```bash
curl -L 
  --url 'https://api.emporix.io/indexing/{tenant}/configurations' 
  --header 'Accept: */*'
```

To change configuration, make a call to the [Update configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#put-indexing-tenant-configurations-provider) endpoint, providing the `writeKey` from the previous step.

{% hint style="warning" %}
The update request replaces the whole configuration. For `BATTERY_INCLUDED`, a request without `apiUrl`, `enrichments`, or `siteAwareMixinsStrategy` resets these fields to their defaults. Send back every field from the response of the previous step.
{% endhint %}

{% hint style="info" %}
See [How to set the BatteryIncluded API URL](#how-to-set-the-batteryincluded-api-url), [How to choose the data that BatteryIncluded indexing uses](#how-to-choose-the-data-that-batteryincluded-indexing-uses), and [How to choose site-aware mixins indexing for BatteryIncluded](#how-to-choose-site-aware-mixins-indexing-for-batteryincluded).
{% endhint %}

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

{% content-ref url="/pages/MjD2ceBtWNWeQyEaK3eA" %}
[API Reference](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference.md)
{% endcontent-ref %}

```bash
curl -L 
  --request PUT 
  --url 'https://api.emporix.io/indexing/{tenant}/configurations/{provider}' 
  --header 'Content-Type: application/json' 
  --data '{
    "active": true,
    "searchKey": "84dc4886f81f805c42bdd89d64de751a",
    "applicationId": "8AP2HABA2I",
    "indexName": "exampleTenant",
    "writeKey": "51ebe89215dddcf85e5dacd5643d17e7",
    "provider": "ALGOLIA"
  }'
```

For `BATTERY_INCLUDED`, `includedMixinPaths` filtering is applied to the raw source mixin tree before the localized and non-localized mixin split. The retained data is then written to the existing BatteryIncluded mixin fields, such as `_product.mixins` and `_product_i18n.<lang>.mixins`. Site-aware mixins are written according to the tenant's `siteAwareMixinsStrategy`.

{% hint style="info" %}
See [How site-aware mixins are indexed](#how-site-aware-mixins-are-indexed).
{% endhint %}

To apply your configuration changes to existing data, run the reindexing process. See the [How to reindex existing products](#how_to_reindex_existing_products) section.

## How to set the BatteryIncluded API URL

The Indexing Service sends a tenant's product data to the default BatteryIncluded host. If BatteryIncluded set up your index on a different host, set that host as the API URL in the `apiUrl` field of the `BATTERY_INCLUDED` configuration. The Indexing Service then sends all of the tenant's BatteryIncluded requests to that host, including product updates, deletions, and reindex uploads. If BatteryIncluded did not give you a host, you don't need `apiUrl`.

The `apiUrl` value must be the `https` address of a BatteryIncluded host that Emporix accepts, for example `https://api.batteryincluded.io` or `https://api-next.batteryincluded.io`, without a path, query, fragment, user information, or port. A trailing slash is allowed. The service rejects any other value with `400` and does not store the configuration. The `apiUrl` field applies only to `BATTERY_INCLUDED`. Sending it in an `ALGOLIA` configuration also returns `400`.

The host and the write key belong together. The service validates `writeKey` against the host in `apiUrl` before saving, so use the write key that BatteryIncluded issued for that host. A write key that is not valid on that host returns `400` with the message `BatteryIncluded credentials are invalid. Verify the write key and index name.`, and the stored configuration stays unchanged.

To set the API URL when you create the configuration, add `apiUrl` to the request body of the [Create a new configuration](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#post-indexing-tenant-configurations) endpoint.

### Prerequisites

The following items are required before you change `apiUrl`:

* The host of your index and a write key for that host, both provided by BatteryIncluded
* An OAuth2 service token with the `indexing.search_view` and `indexing.search_manage` scopes

### Set the API URL on an existing configuration

To set the API URL on an existing `BATTERY_INCLUDED` configuration, complete the following steps:

{% stepper %}
{% step %}

#### Check that no product reindex is running

{% hint style="warning" %}
If you change `apiUrl` while a product reindex is running, the documents uploaded before the change stay on the old host, and the new host holds only the documents uploaded after the change.
{% endhint %}

Send a request to the [Retrieving reindex jobs](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/reindex#get-indexing-tenant-reindex-jobs) endpoint.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

```bash
curl -i -X GET \
  'https://api.emporix.io/indexing/{tenant}/reindex-jobs' \
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}'
```

Continue only when every `PRODUCT` job in the response has the `SUCCESS` or `FAILURE` status. A job with the `PENDING`, `IN_PROGRESS`, or `PUBLISHED` status has not finished yet.
{% endstep %}

{% step %}

#### Retrieve the current configuration

The update request replaces the whole configuration. Send a request to the [Get configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#get-indexing-tenant-configurations-provider) endpoint for `BATTERY_INCLUDED`.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

```bash
curl -i -X GET \
  'https://api.emporix.io/indexing/{tenant}/configurations/BATTERY_INCLUDED' \
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}'
```

Keep every field of the response for the next step, including `includedMixinPaths`, `excludedMixinKeys`, `enrichments`, or `siteAwareMixinsStrategy` when they are set.
{% endstep %}

{% step %}

#### Send the configuration with the API URL

Send the whole configuration with `apiUrl` added to the [Update configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#put-indexing-tenant-configurations-provider) endpoint.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

```bash
curl -i -X PUT \
  'https://api.emporix.io/indexing/{tenant}/configurations/BATTERY_INCLUDED' \
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "active": true,
    "indexName": "exampleTenant",
    "writeKey": "51ebe89215dddcf85e5dacd5643d17e7",
    "provider": "BATTERY_INCLUDED",
    "includedMixinPaths": [
      "*_siteAware.*.OnlineIsService_P",
      "*_siteAware.**"
    ],
    "apiUrl": "https://api-next.batteryincluded.io"
  }'
```

A successful request returns `204`. The [Get configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#get-indexing-tenant-configurations-provider) endpoint then returns the `apiUrl` value. The public configuration endpoints do not return it. See [How to retrieve public search configuration](#how-to-retrieve-public-search-configuration).

If the `apiUrl` value is not accepted, the response names the field:

```json
{
  "code": 400,
  "status": "Bad Request",
  "message": "Invalid apiUrl: must be https on one of api.batteryincluded.io, api-next.batteryincluded.io"
}
```

{% endstep %}

{% step %}

#### Reindex the products on the new host

A changed `apiUrl` takes effect within 10 minutes. Until then, the Indexing Service can still send requests to the previous host.

If the index on the new host does not yet hold all of the tenant's products, wait 10 minutes, and then start a full product reindex. See [How to reindex existing products](#how_to_reindex_existing_products).
{% endstep %}
{% endstepper %}

{% hint style="info" %}
If you later update the configuration without `apiUrl`, the tenant goes back to the default BatteryIncluded host, and the write key must be valid on the default host.
{% endhint %}

## How to choose the data that BatteryIncluded indexing uses

When the Indexing Service indexes a product for BatteryIncluded, it always reads the product, the site settings, and the tenant configuration. It also calls other Emporix services for optional data in the search document, such as availability, prices, and customer segments. These services are the data dependencies of BatteryIncluded indexing. If one of them is unavailable, indexing of the tenant's product updates can be delayed until it responds again. If your search does not use some of this data, you can stop calling those services. List the data dependencies to call in the `enrichments` field of the `BATTERY_INCLUDED` configuration.

The following table shows what each `enrichments` value adds to the site-specific data in `_product_siteAware`, and what changes when the value is not in the list. For the structure of the document, see [How BatteryIncluded indexes products](#how-batteryincluded-indexes-products).

| Value              | What it adds to the BatteryIncluded document                          | When the value is not listed                                                                                                                                                                                             |
| ------------------ | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `AVAILABILITY`     | Availability per site                                                 | The Availability Service is not called. Availability does not decide whether a site contributes to the merged document. `index.item-updated` webhook events have no `availability`, `available`, or `popularity` values. |
| `PRICE`            | Prices per site, grouped by currency                                  | The Price Service is not called. A site without prices still contributes to the merged document. `index.item-updated` webhook events have no `prices` values.                                                            |
| `CUSTOMER_SEGMENT` | Segment IDs per site                                                  | The Customer Segment Service is not called. `index.item-updated` webhook events have no `segmentIds` values.                                                                                                             |
| `FEE`              | No data, because fee data is not part of the BatteryIncluded document | The Fee Service is not called. BatteryIncluded search does not need `FEE`.                                                                                                                                               |

The following rules apply to the `enrichments` list:

* When `enrichments` is not set, the Indexing Service uses `AVAILABILITY`, `PRICE`, and `CUSTOMER_SEGMENT`, and does not call the Fee Service. The configuration endpoints then do not return the field.
* An empty list means that no data dependency is called.
* Values are case sensitive. A list with an unknown or `null` value returns `400`, and the configuration is not stored.
* The field applies only to `BATTERY_INCLUDED`. Sending it for another provider, even as an empty list, also returns `400`.

For how a value that is not listed changes which sites contribute to the merged document, see [When a data dependency is not listed](#when-a-data-dependency-is-not-listed).

{% hint style="warning" %}
When you remove a value from the list, its data is removed from each product's BatteryIncluded document the next time the product is updated or reindexed. A full product reindex removes it from all products at once. Search features that filter or sort by that data, for example by price, stop working for the affected products.

Removing `PRICE` or `AVAILABILITY` can also add products to the index. Products that were left out because their default site had no prices or was unavailable are added after their next update or a reindex. Adding the value back removes those products again.
{% endhint %}

To choose the data when you create the configuration, add `enrichments` to the request body of the [Create a new configuration](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#post-indexing-tenant-configurations) endpoint.

### Prerequisites

The following items are required before you change `enrichments`:

* A `BATTERY_INCLUDED` configuration on a tenant that uses the `MERGE` strategy
* The write key and index name of that configuration. The update request validates them again against the configured BatteryIncluded host.
* An OAuth2 service token with the `indexing.search_view` and `indexing.search_manage` scopes

### Change the data on an existing configuration

To change the data that BatteryIncluded indexing uses, complete the following steps:

{% stepper %}
{% step %}

#### Retrieve the current configuration

The update request replaces the whole configuration. Send a request to the [Get configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#get-indexing-tenant-configurations-provider) endpoint for `BATTERY_INCLUDED`.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

```bash
curl -i -X GET \
  'https://api.emporix.io/indexing/{tenant}/configurations/BATTERY_INCLUDED' \
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}'
```

Keep every field of the response for the next step, including `apiUrl`, `includedMixinPaths`, `excludedMixinKeys`, or `siteAwareMixinsStrategy` when they are set.
{% endstep %}

{% step %}

#### Send the configuration with the `enrichments` list

Send the whole configuration with `enrichments` added to the [Update configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#put-indexing-tenant-configurations-provider) endpoint. The following example keeps availability and prices, and stops calling the Customer Segment Service.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

```bash
curl -i -X PUT \
  'https://api.emporix.io/indexing/{tenant}/configurations/BATTERY_INCLUDED' \
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "active": true,
    "indexName": "exampleTenant",
    "writeKey": "51ebe89215dddcf85e5dacd5643d17e7",
    "provider": "BATTERY_INCLUDED",
    "includedMixinPaths": [
      "*_siteAware.*.OnlineIsService_P",
      "*_siteAware.**"
    ],
    "enrichments": [
      "AVAILABILITY",
      "PRICE"
    ]
  }'
```

A successful request returns `204`. The [Get configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#get-indexing-tenant-configurations-provider) endpoint then returns the `enrichments` list as you sent it. The public configuration endpoints do not return it. See [How to retrieve public search configuration](#how-to-retrieve-public-search-configuration).

If a value is not accepted, the response names the field:

```json
{
  "code": 400,
  "status": "Bad Request",
  "message": "Invalid 'enrichments': unknown value(s) [STOCK]; allowed: [AVAILABILITY, PRICE, CUSTOMER_SEGMENT, FEE]"
}
```

{% endstep %}

{% step %}

#### Apply the change to existing products

A changed `enrichments` list takes effect within 10 minutes. After that, each product uses the new list the next time it is updated or reindexed.

To apply the new list to all products at once, wait 10 minutes, and then start a full product reindex. See [How to reindex existing products](#how_to_reindex_existing_products).
{% endstep %}
{% endstepper %}

{% hint style="info" %}
If you later update the configuration without `enrichments`, the tenant goes back to the default list: `AVAILABILITY`, `PRICE`, and `CUSTOMER_SEGMENT`.
{% endhint %}

## How to choose site-aware mixins indexing for BatteryIncluded

A [site-aware mixin](https://developer.emporix.io/api-documentation/standard-practices/mixins.md#site-aware-mixins) has a base value for the product and optional per-site overlays in `{mixin}__{site}` keys. Your BatteryIncluded search can read a mixin value from the product-wide fields `_product.mixins` and `_product_i18n.<language>.mixins`, or from the site-specific data in `_product_siteAware.<site>`. Choose where the Indexing Service writes site-aware mixins with the `siteAwareMixinsStrategy` field of the `BATTERY_INCLUDED` configuration.

The following table compares the two values:

| Value               | Where the base value is written                               | Which sites receive the merged value                                                                                                                            | When to use it                                                                                                                                |
| ------------------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `FAN_OUT` (default) | Not in `_product.mixins` or `_product_i18n.<language>.mixins` | Every site that contributes to the merged document, and every other site with an `_product_siteAware` entry. A site without an overlay receives the base value. | Your search reads site-aware mixins only from `_product_siteAware`, and every site needs a resolved value.                                    |
| `INHERITANCE`       | `_product.mixins` and `_product_i18n.<language>.mixins`       | Only the sites that have an overlay for the mixin                                                                                                               | Your search reads the shared value from `_product` and uses `_product_siteAware` only for sites that override it. The document stays smaller. |

A site contributes to the merged document when the product is indexed for that site.

{% hint style="info" %}
For the rules, see [How BatteryIncluded indexes products](#how-batteryincluded-indexes-products). For the conditions that make a mixin site-aware, the rules for `_product_siteAware` entries, and an example of both layouts, see [How site-aware mixins are indexed](#how-site-aware-mixins-are-indexed).
{% endhint %}

A search integration can read site-aware mixins in the same way under both strategies. For each site, read `_product_siteAware.<site>.mixins.<mixin>` and `_product_siteAware.<site>.localeAware.<language>.mixins.<mixin>` when they are present. They hold the complete merged value, so do not merge them with the base value again. When they are absent, read `_product.mixins.<mixin>` and `_product_i18n.<language>.mixins.<mixin>`.

{% hint style="info" %}
Under `FAN_OUT`, site-aware mixins are written only under `_product_siteAware`. Every site that contributes to the merged document receives the merged value, and so does every other site with an `_product_siteAware` entry. A site without an overlay receives the base value. Site-aware mixins do not appear in `_product.mixins` or `_product_i18n.<language>.mixins`.
{% endhint %}

The following rules apply to `siteAwareMixinsStrategy`:

* When the field is not set, the Indexing Service uses `FAN_OUT`. The configuration endpoints then do not return the field.
* Values are case sensitive. A value other than `FAN_OUT` or `INHERITANCE` returns `400`, and the configuration is not stored.
* The field applies only to `BATTERY_INCLUDED`. Sending it for another provider also returns `400`.
* The field is a separate setting from the `MERGE` and `SPLIT` indexing strategy. BatteryIncluded indexing runs only with `MERGE`. See [How to choose indexing strategy](#how-to-choose-indexing-strategy).

{% hint style="warning" %}
A changed strategy moves site-aware mixin values between `_product` and `_product_siteAware` the next time each product is updated or reindexed. Until a full product reindex reports `SUCCESS`, documents in both layouts can exist in the index. Before you change the strategy, make sure that your search integration supports both layouts, for example with the read rule above.
{% endhint %}

To choose the strategy when you create the configuration, add `siteAwareMixinsStrategy` to the request body of the [Create a new configuration](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#post-indexing-tenant-configurations) endpoint.

### Prerequisites

The following items are required before you change `siteAwareMixinsStrategy`:

* A `BATTERY_INCLUDED` configuration on a tenant that uses the `MERGE` strategy
* The write key and index name of that configuration. The update request validates them again against the configured BatteryIncluded host.
* An OAuth2 service token with the `indexing.search_view` and `indexing.search_manage` scopes

### Change the site-aware mixin strategy on an existing configuration

To change how site-aware mixins are indexed, complete the following steps:

{% stepper %}
{% step %}

#### Retrieve the current configuration

The update request replaces the whole configuration. Send a request to the [Get configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#get-indexing-tenant-configurations-provider) endpoint for `BATTERY_INCLUDED`.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

```bash
curl -i -X GET \
  'https://api.emporix.io/indexing/{tenant}/configurations/BATTERY_INCLUDED' \
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}'
```

Keep every field of the response for the next step, including `apiUrl`, `includedMixinPaths`, `excludedMixinKeys`, `enrichments`, or `siteAwareMixinsStrategy` when they are set.
{% endstep %}

{% step %}

#### Send the configuration with `siteAwareMixinsStrategy`

Send the configuration from the previous step with `siteAwareMixinsStrategy` added to the [Update configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#put-indexing-tenant-configurations-provider) endpoint. The following example keeps the base values of site-aware mixins in `_product.mixins` and `_product_i18n`. It is based on a configuration that also sets `enrichments`, and it keeps that list. Send your own fields from the previous step instead.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

```bash
curl -i -X PUT \
  'https://api.emporix.io/indexing/{tenant}/configurations/BATTERY_INCLUDED' \
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "active": true,
    "indexName": "exampleTenant",
    "writeKey": "51ebe89215dddcf85e5dacd5643d17e7",
    "provider": "BATTERY_INCLUDED",
    "enrichments": [
      "AVAILABILITY",
      "PRICE"
    ],
    "siteAwareMixinsStrategy": "INHERITANCE"
  }'
```

A successful request returns `204`. The [Get configuration by provider name](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/configuration#get-indexing-tenant-configurations-provider) endpoint then returns `siteAwareMixinsStrategy` as you sent it. The public configuration endpoints do not return it. See [How to retrieve public search configuration](#how-to-retrieve-public-search-configuration).

If the value is not accepted, the response names the field and the allowed values:

```json
{
  "code": 400,
  "status": "Bad Request",
  "message": "Invalid value 'INHERIT' for 'siteAwareMixinsStrategy', allowed values: [FAN_OUT, INHERITANCE]"
}
```

{% endstep %}

{% step %}

#### Apply the change to existing products

A changed `siteAwareMixinsStrategy` takes effect within 10 minutes. After that, each product uses the new strategy the next time it is updated or reindexed.

To apply the new strategy to all products at once, wait 10 minutes, and then start a full product reindex. See [How to reindex existing products](#how_to_reindex_existing_products).
{% endstep %}
{% endstepper %}

{% hint style="info" %}
If you later update the configuration without `siteAwareMixinsStrategy`, the tenant goes back to the default `FAN_OUT`. Site-aware mixin values then move back to `_product_siteAware` the next time each product is updated or reindexed.
{% endhint %}

## How BatteryIncluded indexes products

When the tenant uses `MERGE`, the Indexing Service builds one BatteryIncluded search document per product. Core product fields come from a single base site.

The BatteryIncluded document stores site-specific data in `_product_siteAware`. This field is a map whose keys are site codes. Each value can contain prices grouped by currency, availability, segment IDs, and site-aware mixins for that site. Availability can appear for a site even when that site has no prices.

{% hint style="info" %}
For site-aware mixins, see [How site-aware mixins are indexed](#how-site-aware-mixins-are-indexed).
{% endhint %}

If your tenant uses `SPLIT`, BatteryIncluded product indexing is skipped.

{% hint style="info" %}
To set the strategy, see [How to choose indexing strategy](#how-to-choose-indexing-strategy).
{% endhint %}

### How the base site is chosen

When the Indexing Service merges per-site product data into one document, it picks the base site in this order:

1. A site that matches one of the tenant default sites
2. The `main` site, if no matching default-site data is available
3. The first available site, if neither of the above matches

The merged document is stored under site code `main`, which is how `MERGE` keeps a single per-product document.

### Special rules for the `main` site

For the `main` site, a product can still be indexed when it is unpublished, has no prices, or is unavailable.

For any other site, those conditions mean that site does not contribute prices, availability, or segment IDs to the merged document. If the chosen base site is such a site, the product is removed from BatteryIncluded.

Missing prices affect these rules only while `PRICE` is in the tenant's `enrichments` list, and missing availability only while `AVAILABILITY` is in it. Both are in the default list. See [When a data dependency is not listed](#when-a-data-dependency-is-not-listed).

### When the default site is `main`

When a tenant default site is `main`, the following applies:

* Base product fields come from `main`.
* The `main` site rules above apply to the base site, so unpublished, no-price, or unavailable status on that default site does not by itself remove the product from BatteryIncluded.
* Sites that still contribute data write their prices, availability, and segment IDs to `_product_siteAware`.

### When the default site is not `main`

When the matching tenant default site is not `main`, the following applies:

* Base product fields come from that default site when it still contributes data.
* If that default site would not index the product (for example because it is unpublished, has no price, or is unavailable), the product is removed from BatteryIncluded.
* Otherwise, `_product_siteAware` still includes every site that contributed prices, availability, or segment IDs.

### When a data dependency is not listed

When a value is not in the tenant's `enrichments` list, the Indexing Service does not call that data dependency for any site, including `main`. A missing price or missing availability then no longer stops a site from contributing to the merged document.

The following applies when `PRICE` or `AVAILABILITY` is not listed:

* Without `PRICE`, a site without prices still contributes to the merged document. A default site that is not `main` and has no prices does not remove the product from BatteryIncluded.
* Without `AVAILABILITY`, availability does not decide whether a site contributes to the merged document. A default site that is not `main` and is unavailable does not remove the product from BatteryIncluded.

These rules apply to product updates and to product reindexes. Other conditions still apply. For example, a site where the product is unpublished does not contribute to the merged document.

The data of a value that is not listed is missing from `_product_siteAware` and from [`index.item-updated`](https://developer.emporix.io/api-documentation/api-guides/webhooks/webhook-events/events-index.md) webhook events. For the values and how to set them, see [How to choose the data that BatteryIncluded indexing uses](#how-to-choose-the-data-that-batteryincluded-indexing-uses).

### How site-aware mixins are indexed

The Indexing Service treats a mixin as site-aware when one of the following conditions is met:

* The source product contains an overlay key for the mixin in the form `{mixin}__{site}`.
* The schema file that the product references for the mixin in `metadata.mixins` is marked as site-aware.

Mark the schema with `siteAware: true` so that the product follows the standard [site-aware mixin](https://developer.emporix.io/api-documentation/standard-practices/mixins.md#site-aware-mixins) model, and declare only the base mixin under `metadata.mixins`.

The Indexing Service reads `siteAware` from the root of the schema file at the URL in `metadata.mixins`. Each schema version has its own file and URL. Schema files of older versions might not contain `siteAware`, and then the mixin counts as not site-aware. To make an existing schema count as site-aware, update the schema with `siteAware: true`. The update creates a new schema version. Retrieve the schema to get the URL of that version, and point each product's `metadata.mixins` entry to it. See [How to create a site-aware mixin schema](https://developer.emporix.io/api-documentation/api-guides/utilities/schema/schema.md#how-to-create-a-site-aware-mixin-schema).

Products that reference an older version are site-aware only through their overlay keys. Under `FAN_OUT`, the same mixin can therefore be in `_product` for some products and in `_product_siteAware` for others.

If no schema URL is declared or the schema file cannot be loaded, only overlay keys make the mixin site-aware, and its localized fields are not separated. The whole mixin is then written to the non-localized paths, such as `_product_siteAware.<site>.mixins.<mixin>`.

A site has an `_product_siteAware` entry when it has prices, availability, or segment IDs, or when the product has an overlay for that site. With `FAN_OUT`, every site that contributes to the merged document also gets an entry when the product has site-aware mixins. A site entry that would hold no data is not written.

For each site that receives a site-aware mixin, the Indexing Service deep-merges the site's overlay into the base mixin. Nested overlay fields replace matching base fields, while the other base fields remain. Arrays and scalar values in the overlay replace the base value. A `null` overlay value does not clear the base value.

Which sites receive the merged mixin depends on the tenant's `siteAwareMixinsStrategy`.

{% hint style="info" %}
For how to set it, see [How to choose site-aware mixins indexing for BatteryIncluded](#how-to-choose-site-aware-mixins-indexing-for-batteryincluded).
{% endhint %}

The strategies work as follows:

* `FAN_OUT` (default) – every site that contributes to the merged document receives the merged mixin, and so does every other site with an `_product_siteAware` entry, for example a site with an overlay key. A site without an overlay receives the base mixin. The base mixin is not written to `_product.mixins` or `_product_i18n.<language>.mixins`.
* `INHERITANCE` – the base mixin stays in `_product.mixins` and `_product_i18n.<language>.mixins`. Only sites with an overlay key for the mixin receive the merged mixin in `_product_siteAware`.

After the merge, schema-identified localized fields and non-localized fields use separate paths:

* `_product_siteAware.<site>.mixins.<mixin>` contains the non-localized part of the merged mixin.
* `_product_siteAware.<site>.localeAware.<language>.mixins.<mixin>` contains its localized part.

Overlay keys never appear in the BatteryIncluded document. Mixins that are not site-aware keep using `_product.mixins` for non-localized fields and `_product_i18n.<language>.mixins` for schema-identified localized fields.

The following source product fragment contains a `productInfo` base, a `main` overlay, and a non-site-aware `internalFlags` mixin. The mixin schemas identify `title` and `note` as localized fields:

```json
{
  "mixins": {
    "productInfo": {
      "skuHint": "BASE",
      "details": {
        "material": "cotton",
        "care": {
          "temperature": 30
        }
      },
      "title": {
        "en": "Shirt",
        "de": "Hemd"
      }
    },
    "productInfo__main": {
      "skuHint": "MAIN",
      "details": {
        "care": {
          "temperature": 40
        }
      },
      "title": {
        "de": "Premiumhemd"
      }
    },
    "internalFlags": {
      "hidden": false,
      "note": {
        "en": "Operations",
        "de": "Betrieb"
      }
    }
  },
  "metadata": {
    "mixins": {
      "productInfo": "https://example.com/schemas/productInfo-v1.json",
      "internalFlags": "https://example.com/schemas/internalFlags-v1.json"
    }
  }
}
```

Assume both `main` and `germany` contribute to the merged document. With `FAN_OUT`, the relevant output has the following shape:

```json
{
  "_product": {
    "mixins": {
      "internalFlags": {
        "hidden": false
      }
    }
  },
  "_product_i18n": {
    "en": {
      "mixins": {
        "internalFlags": {
          "note": "Operations"
        }
      }
    },
    "de": {
      "mixins": {
        "internalFlags": {
          "note": "Betrieb"
        }
      }
    }
  },
  "_product_siteAware": {
    "main": {
      "segmentIds": [
        "seg-main"
      ],
      "mixins": {
        "productInfo": {
          "skuHint": "MAIN",
          "details": {
            "material": "cotton",
            "care": {
              "temperature": 40
            }
          }
        }
      },
      "localeAware": {
        "en": {
          "mixins": {
            "productInfo": {
              "title": "Shirt"
            }
          }
        },
        "de": {
          "mixins": {
            "productInfo": {
              "title": "Premiumhemd"
            }
          }
        }
      }
    },
    "germany": {
      "segmentIds": [
        "seg-germany"
      ],
      "mixins": {
        "productInfo": {
          "skuHint": "BASE",
          "details": {
            "material": "cotton",
            "care": {
              "temperature": 30
            }
          }
        }
      },
      "localeAware": {
        "en": {
          "mixins": {
            "productInfo": {
              "title": "Shirt"
            }
          }
        },
        "de": {
          "mixins": {
            "productInfo": {
              "title": "Hemd"
            }
          }
        }
      }
    }
  }
}
```

With `INHERITANCE`, the base `productInfo` stays in `_product` and `_product_i18n`. Only `main`, which has an overlay, receives the merged mixin. The relevant output has the following shape:

```json
{
  "_product": {
    "mixins": {
      "productInfo": {
        "skuHint": "BASE",
        "details": {
          "material": "cotton",
          "care": {
            "temperature": 30
          }
        }
      },
      "internalFlags": {
        "hidden": false
      }
    }
  },
  "_product_i18n": {
    "en": {
      "mixins": {
        "productInfo": {
          "title": "Shirt"
        },
        "internalFlags": {
          "note": "Operations"
        }
      }
    },
    "de": {
      "mixins": {
        "productInfo": {
          "title": "Hemd"
        },
        "internalFlags": {
          "note": "Betrieb"
        }
      }
    }
  },
  "_product_siteAware": {
    "main": {
      "segmentIds": [
        "seg-main"
      ],
      "mixins": {
        "productInfo": {
          "skuHint": "MAIN",
          "details": {
            "material": "cotton",
            "care": {
              "temperature": 40
            }
          }
        }
      },
      "localeAware": {
        "en": {
          "mixins": {
            "productInfo": {
              "title": "Shirt"
            }
          }
        },
        "de": {
          "mixins": {
            "productInfo": {
              "title": "Premiumhemd"
            }
          }
        }
      }
    },
    "germany": {
      "segmentIds": [
        "seg-germany"
      ]
    }
  }
}
```

Commercial fields keep their existing paths and behavior. For example, `segmentIds`, `availability`, and `currencyAware` remain siblings of `mixins` and `localeAware` under each `_product_siteAware.<site>` entry.

Mixin filters also keep their existing behavior under both strategies. The Indexing Service applies `includedMixinPaths` and `excludedMixinKeys` to the raw source mixin tree before it detects site-aware mixins, merges overlays, or separates localized values. Filter patterns therefore match source paths such as `productInfo` and `productInfo__main`, not the generated `_product_siteAware` paths. Excluding a base mixin with `excludedMixinKeys` also excludes its overlays.

### Migrating from legacy mixin paths

{% hint style="danger" %}
To keep existing integrations working after a rollout, incremental update, or reindex, add support for the new paths before the new document shape reaches the index. Retain fallback reads from the old paths during the transition.
{% endhint %}

In the legacy layout, site-aware mixins stayed under `_product.mixins` and `_product_i18n.<language>.mixins`, together with their `{mixin}__{site}` overlay keys. The following steps move a search integration from that layout to the `_product_siteAware` paths.

{% stepper %}
{% step %}

#### Add dual-read support

Update consumers to read non-localized values from `_product_siteAware.<site>.mixins.<mixin>` and localized values from `_product_siteAware.<site>.localeAware.<language>.mixins.<mixin>`. Here, `<mixin>` is the base mixin key, `<site>` is the tenant site code used as the overlay suffix, and `<language>` is a language key found in the localized mixin data.

Use the following legacy paths when the corresponding new path is absent:

* For non-localized values, use the base `_product.mixins.<mixin>` and overlay `_product.mixins.<mixin>__<site>` paths.
* For localized values, use the base `_product_i18n.<language>.mixins.<mixin>` and overlay `_product_i18n.<language>.mixins.<mixin>__<site>` paths.

The consumer deep-merges the legacy overlay value into the legacy base value during fallback. A `null` overlay value preserves the base value.

With `INHERITANCE`, `_product.mixins.<mixin>` and `_product_i18n.<language>.mixins.<mixin>` remain the base paths for sites without an overlay. Treat only the `<mixin>__<site>` overlay paths as legacy.
{% endstep %}

{% step %}

#### Roll out the change

Roll out the change and keep both reads while old and new document shapes coexist. Run a [full reindex](#how_to_reindex_existing_products) to migrate all products in a bounded operation. If you rely on incremental updates without a full reindex, both shapes can coexist indefinitely. Keep the fallback reads in that case.
{% endstep %}

{% step %}

#### Remove fallbacks after a full reindex

If you run a full reindex, wait until it reports `SUCCESS`, then allow BatteryIncluded time to apply the transaction cleanup. Verify through your search integration that reindexed documents contain the `_product_siteAware` paths for site-aware mixins. Remove the old-path fallbacks after this verification. If you use only incremental updates, skip this step and keep the fallbacks.

With `INHERITANCE`, sites without an overlay have no site-aware mixin in `_product_siteAware`. Keep reading the base value from `_product.mixins.<mixin>` and `_product_i18n.<language>.mixins.<mixin>` for those sites. Remove only the fallbacks to the `_product.mixins.<mixin>__<site>` and `_product_i18n.<language>.mixins.<mixin>__<site>` overlay paths.
{% endstep %}
{% endstepper %}

To rebuild the BatteryIncluded index after configuration changes, see [How to reindex existing products](#how_to_reindex_existing_products).

## How to reindex existing products <a href="#how_to_reindex_existing_products" id="how_to_reindex_existing_products"></a>

Usually, reindexing runs upon the update of a product or its dependant entity, such as category, price, or media. The scheduler job discovers what has been changed and pushes the changes to index frequently. But, if you change your index configuration, you need to trigger the reindexing process to apply your configuration changes. You can run the reindex without the need to update all your resource data by sending the request to the [Creating a reindex job](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/reindex#post-indexing-tenant-reindex-jobs) endpoint. Creating a job requires an OAuth2 service token with the `indexing.search_manage` scope. Tracking the job with [Retrieving a reindex job](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/reindex#get-indexing-tenant-reindex-jobs-reindexjobid) requires `indexing.search_view`.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

{% content-ref url="/pages/MjD2ceBtWNWeQyEaK3eA" %}
[API Reference](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference.md)
{% endcontent-ref %}

```bash
curl -i -X POST \
  'https://api.emporix.io/indexing/{tenant}/reindex-jobs' \
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "entityType": "PRODUCT"
  }'
```

A successful response returns a reindex job, including its `id`. You can track progress with the [Retrieving a reindex job](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/reindex#get-indexing-tenant-reindex-jobs-reindexjobid) endpoint. The job runs in full mode for the selected `entityType`. For BatteryIncluded product reindexes, see [How BatteryIncluded reindexing works](#how-batteryincluded-reindexing-works).

### How BatteryIncluded reindexing works

When a product reindex job is created for `BATTERY_INCLUDED`, the Indexing Service uploads documents to BatteryIncluded and cleans up the index after commit.

Each upload and the final commit go to the BatteryIncluded host that is configured for the tenant when that upload or commit is sent, with the write key from the same configuration. To avoid splitting a reindex across two hosts, don't change `apiUrl` while a reindex is running. See [How to set the BatteryIncluded API URL](#how-to-set-the-batteryincluded-api-url).

When the active provider is `BATTERY_INCLUDED`, a full product reindex does not empty the index at the start. Existing documents stay searchable while the Indexing Service uploads the new set. Emporix completes the upload and runs cleanup for you. You can track progress with the [Retrieving a reindex job](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/reindex#get-indexing-tenant-reindex-jobs-reindexjobid) endpoint.

Use `processedCount` to see how many entities Emporix has already processed. When the count is close to `expectedCount`, Emporix has sent the remaining documents to BatteryIncluded; allow a short time for BatteryIncluded to finish applying them.

While a reindex job is `IN_PROGRESS`, live product updates are not written to the index immediately. They are queued and applied after the reindex completes.

Each reindex job has an `id`, and that value is sent to BatteryIncluded as `transactionId` on every document that belongs to the job. Eligible products are uploaded with this label. If a matching document is already in the index, it is updated in place in the same way as during normal incremental indexing, and labeled with the current `transactionId`. Products that are not eligible for reindexing are not sent. Eligibility follows the same BatteryIncluded indexing rules as day-to-day updates; see [How BatteryIncluded indexes products](#how-batteryincluded-indexes-products).

When every document intended for the job has been sent, the upload is committed. A job status of `SUCCESS` means the reindex transaction was committed. After commit, BatteryIncluded removes documents that were not sent with this `transactionId`, so the index should not retain documents that were not part of the job. The cleanup applies only to the BatteryIncluded search index for the tenant and this reindex transaction; it does not delete products in Emporix. Until commit and cleanup are finished, search can still return documents that the current job has not replaced. After cleanup, the index matches the documents labeled with that `transactionId`.

```mermaid
---
config:
  layout: fixed
  theme: base
  look: classic
  themeVariables:
    background: transparent
    lineColor: "#9CBBE3"
    arrowheadColor: "#9CBBE3"
    edgeLabelBackground: "#FFC128"
    edgeLabelTextColor: "#4C5359"
---
flowchart LR
  subgraph EMP["Emporix"]
    direction TB
    P1["Product 1"]
    P2["Product 2"]
    P3["Product 3"]
  end

  subgraph UPLOAD["Upload"]
    direction TB
    ND["ndjson documents<br/>transactionId = X"]
  end

  subgraph BI["BatteryIncluded index"]
    direction TB
    KEEP["Existing documents<br/>stay searchable"]
    LABELED["Docs labeled with X<br/>updated in place"]
    CLEAN["After commit<br/>docs without X removed"]
  end

  P1 --> ND
  P2 --> ND
  P3 --> ND
  ND -->|send| LABELED
  KEEP --> LABELED
  LABELED --> CLEAN

  P1@{ shape: rounded}
  P2@{ shape: rounded}
  P3@{ shape: rounded}
  ND@{ shape: rounded}
  KEEP@{ shape: rounded}
  LABELED@{ shape: rounded}
  CLEAN@{ shape: rounded}

  classDef Class_01 stroke-width:1px,stroke:#A1BDDC,fill:#A1BDDC
  classDef Class_02 stroke-width:1px,stroke:#DDE6EE,fill:#DDE6EE
  classDef Class_03 stroke-width:1px,stroke:#3B73BB,fill:#3B73BB,color:#FFFFFF
  class P1,P2,P3 Class_01
  class ND,KEEP,LABELED Class_02
  class CLEAN Class_03
```

{% hint style="warning" %}
For `BATTERY_INCLUDED` product reindexes, invalid stored credentials return `BatteryIncluded credentials are invalid. Verify the write key and index name.` No reindex job is created. Update the configuration first, then retry. If BatteryIncluded is temporarily unreachable, the request returns `502` with `BatteryIncluded credential validation is temporarily unavailable. Try again later.`
{% endhint %}

## How to retrieve public search configuration

How to retrieve public search configuration

If you want to get your storefront index configuration without the need to update, you can call the public endpoint to get the `searchKey`. Send the request to the [Get all public configurations](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference/public-configuration#get-indexing-tenant-public-configurations) endpoint.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

{% content-ref url="/pages/MjD2ceBtWNWeQyEaK3eA" %}
[API Reference](https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/api-reference.md)
{% endcontent-ref %}

```bash
curl -i -X GET \
  'https://api.emporix.io/indexing/{tenant}/public/configurations' \
  -H 'Accept: */*'
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.emporix.io/api-documentation/api-guides/configuration/indexing-service/indexing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
