> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enterspeed.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Source Groups

Source groups contains the sources you ingest your source entities into. Typically you have a source per environment inside a source group.

## Modes

Source groups works in two different modes. Modes are selected on source group creation and can't be changed afterwards.

![Source group modes](https://mintcdn.com/enterspeed/U-p4hKh6hit1rd09/images/docs/key-concepts/source-groups-modes.png?fit=max\&auto=format\&n=U-p4hKh6hit1rd09\&q=85\&s=4eb211ef3623f8fa8963a670b88a0f18)

### Schema Transformation (default)

Schema Transformation is the default and recommended mode for most scenarios. It enables you to transform and combine source entities into views or index items using defined schemas.

Once processed, views can be accessed via the [Delivery API](https://docs.enterspeed.com/api-reference/delivery), while index items are available for querying through [Query API](https://docs.enterspeed.com/api-reference/query).

The schema transformation is a powerfull feature, allowing you to tailor and structure data precisely to meet consumer needs. However, because the transformation process takes time, this mode is best suited for non-real-time data.

### Auto Indexing

> [!NOTE]
>
> Auto Indexing mode are currently in preview.

On Auto indexing mode there is no transformation process. Instead, ingested source entities goes directly into an index, which can be queried using the [Query API](https://docs.enterspeed.com/api-reference/query/query-items-from-auto-indexing-source-groups.md).

Since no transformation is involved, the Auto Indexing mode is suited for scenarios such as handling large volumes of small, custom price objects that don't require transformation, or frequently changing data like stock numbers.

For each source entity type you want to query, you add a type mapping. You name it after the source entity type it indexes — for example `price` — and define the fields and their data types in JSON, as in the example below.

```json theme={null}
{
  "fields": { // the fields that are added to the index
    "sku": {
      "type": "keyword",
      "metadata": {
        "description": "The product key"
      }
    },
    "price": {
      "type": "float",
      "metadata": {
        "description": "The sales price of the product"
      }
    },
    "validFrom": {
      "type": "date",
      "metadata": {
        "description": "A from date where the price is active"
      }
    },
    "validTo": {
      "type": "date",
      "metadata": {
        "description": "A to date where the price is active"
      }
    }
  },
  "metadata": {
    "description": "The price of a product for a specific time interval"
  }
}
```

The type name isn't part of this JSON — you set it on the mapping itself. Add one mapping per source entity type you want to query, and add more whenever you need them.

> [!NOTE]
>
> Only top-level properties holding a single value, or a list of single values, can be indexed. Nested objects, and lists of objects, are never indexed and can't be added to a mapping.

> [!NOTE]
>
> Properties that aren't defined in the type's fields aren't added to the index, so you can't query them. Your source entities are stored in full, so adding an indexable property to the mapping later populates it for the entities you have already ingested — you don't need to re-ingest them.

> [!TIP]
>
> You can add, change, and remove type mappings after the source group is created. See [Managing type mappings](#managing-type-mappings).

## Types

Setting the right types for the properties in your index is important. The types defines the intend of the fields and prevents data of other types from going into the index. The types also helps with effeciently index, search, and analyze of the data added to the index.

> [!WARNING]
>
> If a value doesn't match the field's type, or is too large for the type to hold, the item isn't indexed. The source entity still ingests successfully, but indexing fails with an invalid field error. As a result, the item doesn't show up in query results. Check the log for failed indexing and a description of the indexing error.

### Text

| Type | Description |
| - | - |
| keyword | The `Keyword` type is for non-analyzed string values used in e.g. filtering and sorting. Can hold up to 32,766 bytes (UTF-8). |
| text | The `text` type will analyze string values. This makes it possible to do fuzzy search using the `search` property in the [Query API](https://docs.enterspeed.com/api-reference/query/query-items-from-auto-indexing-source-groups.md) but index time takes a bit longer. Can hold up to 32,766 bytes (UTF-8). |

### Numeric

| Type | Description |
| - | - |
| integer | A 32 bit signed integer |
| long | A 64 bit signed integer |
| float | A 32 bit signed floating number |
| double | A 64 bit signed floating number |

### Boolean

| Type | Description |
| - | - |
| boolean | A `true` / `false` value |

### Date

| Type | Description |
| - | - |
| date | Support values like a Javascript Date object, a string like `2024-11-21` or `2024-11-21T23:00:00Z` or number of milliseconds since eclipse |

### List

| Type | Description |
| - | - |
| keyword\[] | List of the `Keyword` type for non-analyzed string values used in e.g. filtering and sorting. Can hold up to 32,766 bytes (UTF-8) for each element in the list. |
| text\[] | List of the `text` type for analyzing string values. This makes it possible to do fuzzy search using the `search` property in the [Query API](https://docs.enterspeed.com/api-reference/query/query-items-from-auto-indexing-source-groups.md) but index time takes a bit longer. Can hold up to 32,766 bytes (UTF-8) for each element in the list. |
| integer\[] | List of 32 bit signed integers |
| long\[] | List of 64 bit signed integers |
| float\[] | List of 32 bit signed floating numbers |
| double\[] | List of 64 bit signed floating numbers |
| boolean\[] | List of `true` / `false` values |
| date\[] | List of dates with supported values like a Javascript Date object, strings like `2024-11-21T23:00:00Z` or numbers of milliseconds since eclipse |

## Managing type mappings

You can add, change, and remove type mappings on an Auto Indexing source group at any time. Each type gets its own index, so a change to one type never affects the others.

![Type mappings on a source group](https://mintcdn.com/enterspeed/4Yc2xMnCQALsqW3V/images/docs/key-concepts/auto-index-type-mappings.png?fit=max\&auto=format\&n=4Yc2xMnCQALsqW3V\&q=85\&s=23ee149b3ddb6410d71f383f63fc4ffa)

### Adding a type

Add a mapping for a type that isn't indexed yet, and Enterspeed creates the index and fills it from the source entities you have already ingested. You don't need to re-ingest anything.

Indexing runs in the background, so it can take a moment before every entity is queryable.

### Changing a type

What happens when you save depends on what you changed.

| Change | What happens |
| - | - |
| Descriptions and other metadata only | Written to the index straight away. Nothing is re-indexed. |
| Adding or removing a field | The index is rebuilt in the background. |
| Changing a field's type | The index is rebuilt in the background, if the change is compatible. |

![Editing a type mapping](https://mintcdn.com/enterspeed/4Yc2xMnCQALsqW3V/images/docs/key-concepts/auto-index-edit-type-mapping.png?fit=max\&auto=format\&n=4Yc2xMnCQALsqW3V\&q=85\&s=8ee41835e4f5b629a8f03e359c813926)

Rebuilds are zero-downtime. Enterspeed builds a new version of the index alongside the live one and switches over once it has caught up, so your queries keep returning complete results throughout.

Because a rebuild re-indexes from the source entities Enterspeed already stores, adding a field also populates it for your existing entities — including properties that weren't in the index before.

### Compatible field type changes

A rebuild re-indexes your existing values under the new type, so a type change is only allowed when every value can survive it. Adding and removing fields is always allowed.

| From | To |
| - | - |
| `integer` | `long`, `double` |
| `long` | `double` |
| `float` | `double` |
| `keyword` | `text` |
| `integer`, `long`, `float`, `double`, `boolean`, `date` | `text`, `keyword` |
| any type | a list of that type, or of any type it can change to |

Converting a number or date to `text` or `keyword` keeps the value but loses range and sort behaviour, so filter on it as a string afterwards.

These changes are rejected, because existing values would be lost:

* Narrowing a number, such as `double` to `integer`
* `text` to `keyword`, which isn't supported at the moment
* A list to a single value, such as `keyword[]` to `keyword`
* Switching between unrelated types, such as `date` to `integer`

### Replacing a type

Sometimes you need a change that the rules above reject, but your data supports it anyway. Say you mapped a price field as `text` and it should have been `double` — that change is rejected because a `text` field *can* hold values that aren't numbers, not because yours does.

For cases like this you can replace the type instead. Enterspeed tells you which fields are the problem and offers this per type, so you can replace one type and leave the rest of your changes to go through normally.

![An incompatible type change](https://mintcdn.com/enterspeed/4Yc2xMnCQALsqW3V/images/docs/key-concepts/auto-index-incompatible-change.png?fit=max\&auto=format\&n=4Yc2xMnCQALsqW3V\&q=85\&s=4075ee1de4cdc9cbbdbe9dd91eb43535)

Replacing rebuilds the index from your stored source entities, skipping the compatibility check. Every entity whose values fit the new type is kept — so if all your `text` values really are numbers, they all survive the change to `double`.

Any entity holding a value that doesn't fit is left out of the index entirely, not just that one field, so you can no longer query it. The entity itself is kept and is queryable again once re-ingested with a matching value — but this is exactly what the compatibility check normally protects you from, so make sure you know your data before replacing a type.

### Removing a type

Removing a mapping deletes the index for that type, so you can no longer query it.

Your source entities are kept. Entities of a removed type — or of any type on a source with no mappings configured yet — are marked **Not configured** in the source entities list, so you can see at a glance which ones aren't indexed. Add the mapping back later and Enterspeed fills the index again from the entities it already has.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.