Create, view, update, and delete Collections; update the Mapping and dynamic Settings; pre-create Backings; register, query, list, and delete Slices; and manage Collection Aliases. A Backing is the underlying index in which the system stores documents. One Backing can contain multiple Slices. The examples use a Collection in namespace mode named the quickstart knowledge-chunks. The creation examples show different configuration methods and cannot be repeatedly run if a Collection with the same name already exists. Use the update API for parameters that can be updated. For parameters that cannot be modified after creation, create another Collection.
Create a Collection
Collection names must comply with the Elasticsearch naming rules for indexes and aliases. A name must be lowercase, cannot exceed 128 bytes in length, and cannot use the system-reserved .sc- prefix.
PUT /_slice_collection/{collection}Query parameters: master_timeout (the time to wait for the master node to process the request) and timeout (the time to wait for creation acknowledgment).
The following table describes the request body parameters.
Parameter | Default value | Description |
|
| The Collection mode. Namespace mode ( |
|
| Specifies whether to automatically register a Slice when a write request references a nonexistent Slice. |
|
| The value must be greater than 0. This parameter is used with the number of primary shards to calculate the threshold for the number of new Slices that a Backing can accept. It does not limit the number of documents in a single Slice. For more information, see How capacity parameters take effect. |
|
| The soft storage threshold per primary shard for accepting new Slices. Set this parameter to |
|
| The Backing selection policy for new Slices. |
|
| The Elasticsearch index settings used by Backing Indexes. If not explicitly configured, |
|
| The Mapping of the Collection. The Mapping is applied to all Backing Indexes. |
|
| The Collection Alias to create together with the Collection. Only the |
| None | The configuration for vector cluster retrieval mode. For more information, see Vector cluster retrieval reference. Namespace mode does not accept a non-empty |
Example:
PUT /_slice_collection/knowledge-chunks
{
"max_slices_per_shard": 200,
"max_storage_per_shard": "50gb",
"settings": {
"index.number_of_shards": 2,
"index.number_of_replicas": 2
},
"mappings": {
"properties": {
"tenant_id": { "type": "keyword" },
"category": { "type": "keyword" }
}
}
}Sample success response:
{
"acknowledged": true
}acknowledged=true indicates that the Collection configuration is created. If the request times out or the connection fails, call GET /_slice_collection/knowledge-chunks to check the actual status. Do not determine whether the Collection was created based on the response to a retry.
How capacity parameters take effect
max_slices_per_shard is a top-level parameter in the Collection creation request body and does not belong to settings. The system calculates the number of new Slices that a Backing can accept based on the number of primary shards in the Backing. This helps plan how multiple business partitions share a group of underlying shards.
The system determines whether to continue allocation based on the total number of Slices in a Backing. If a Backing has N primary shards, the threshold is N × max_slices_per_shard. Replicas are not included in the calculation. For example, if a Backing has two primary shards and the parameter is set to 200, the threshold is 400 Slices. This does not guarantee that each primary shard is allocated the same number of Slices, nor is it a strict hard limit for each primary shard.
The system also asynchronously checks the document storage size of each primary shard and compares the maximum value with max_storage_per_shard. After the threshold is reached, the system stops allocating new Slices to the Backing. This is an allocation threshold for new Slices, not a real-time disk capacity limit. The storage threshold or a stopped allocation state (assign=disabled in CAT) may cause a Backing to stop accepting new Slices before the quantity threshold is reached.
max_slices_per_shard and max_storage_per_shard determine only whether subsequent new Slices continue to be allocated to the Backing:
After either threshold is reached, the system selects or creates another Backing for new Slices.
Existing Slices can still accept writes.
Changing a threshold does not migrate existing Slices or rebalance existing data.
If you have many small Slices, you can increase the value based on stress test results to reduce the number of required Backings. If a single Slice contains a large data volume or handles a heavy workload, you can decrease the value so that subsequent new Slices use other Backings sooner. The storage threshold still takes effect after the quantity threshold is increased. Increasing this value alone cannot resolve issues with existing data or query hotspots. You can adjust the parameters as described in Update a Collection.
backing_allocation_strategy defaults to last, which is suitable in most cases. Use random only when multiple Backings can accept new Slices at the same time and you want to randomly distribute newly registered Slices among them. If you call the pre-creation API with count > 1, the system performs an automatic switchover to random. For more information, see Pre-create Backings.
Backings are created on demand by default. Before you enable tenants or import data in batches, you can pre-create Backings. For more information, see Pre-create Backings.
Optimize text retrieval within specified Slices
If keyword searches or searches of the full-text index typically query only one or a small number of specified Slices, you can use index.sliced_postings.enabled when you create the Collection to reduce the range of inverted-index data that queries must access.
Default value: In namespace mode (exact), if the parameter is not configured or is set to null, the default value is true. In vector cluster retrieval mode (vector_cluster), the default value is false. If true or false is explicitly configured, the configured value is used.
This setting can be specified only when the Collection is created and cannot be modified after creation.
Queries that use _slice=_all to search all Slices cannot benefit from this optimization and typically incur additional query overhead. If your business primarily performs global text retrieval, we recommend that you explicitly disable the setting when you create the Collection. The following example shows only the relevant settings. During actual creation, also provide the required settings, Mapping, and shard configuration:
PUT /_slice_collection/text-search-demo
{
"settings": {
"index.sliced_postings.enabled": false
}
}This setting takes effect by default in namespace mode. Before you create a Collection, check field and encoding constraints for sliced postings. If incompatible fields or configurations exist, explicitly set the parameter to false during creation.
View Collections
GET /_slice_collection/knowledge-chunksList all Collections:
GET /_slice_collection{collection} supports comma-separated names and wildcards. If an exact name does not exist, HTTP 404 is returned. If a wildcard has no matching item, {"slice_collections": {}} is returned.
Query parameters:
Parameter | Default value | Description |
|
| Specifies whether to return settings with flattened key names. |
|
| The maximum amount of time to wait for Collection metadata to become available. |
This API requires only the monitor index privilege on the target Collection. The cluster-level monitor privilege is not required.
Sample response:
{
"slice_collections": {
"knowledge-chunks": {
"collection_uuid": "opaque-system-id",
"lifecycle_state": "active",
"max_slices_per_shard": 200,
"max_storage_per_shard": "50gb",
"backing_allocation_strategy": "last",
"future_only_settings": {},
"auto_create_slice": true,
"slice_strategy": "exact",
"max_managed_backing_generation": 0,
"latest_backing": {
"settings": {
"index": {
"number_of_shards": "2",
"number_of_replicas": "2"
}
},
"mappings": {
"properties": {
"tenant_id": { "type": "keyword" },
"category": { "type": "keyword" }
}
}
},
"aliases": {}
}
}
}Field descriptions:
latest_backingcomes from the latest Backing Index that still exists.settingscontains the current inheritable and public settings of the Backing. It may include fields that were automatically added by the system or subsequently updated.mappingsis the current Mapping of the Backing and therefore also includes dynamically added fields.future_only_settingsaffects only subsequently created Backings and does not indicate that the latest current Backing already uses these values.collection_uuidandmax_managed_backing_generationare fields for system administration. Applications must treat them as opaque information and must not use them to construct Backing names or implement business logic.
Update a Collection
This API adjusts the allocation policy for subsequently registered Slices. It does not move existing Slices. To change the Mapping or dynamic index settings for all current Backings, use the Mapping and dynamic Settings update API described in the next section instead.
POST /_slice_collection/knowledge-chunks/_update
{
"max_slices_per_shard": 300,
"max_storage_per_shard": "80gb",
"backing_allocation_strategy": "last",
"auto_create_slice": false,
"settings": {
"apack.slice_collection.future.index.number_of_shards": 4
}
}Query parameters:
Parameter | Default value | Description |
|
| The time to wait for the master node to process the request. |
|
| The time to wait for update acknowledgment. |
|
| If this parameter is set to |
The following fields can be updated: max_slices_per_shard, max_storage_per_shard, backing_allocation_strategy, auto_create_slice, and allowed future-effective settings in settings.
Future-effective settings affect only Backings created later and do not modify existing Backings. The following settings are allowed by default:
index.number_of_shardsindex.routing_partition_sizeindex.number_of_routing_shardsIn an
_updaterequest, these settings must use theapack.slice_collection.future.prefix. For example,index.number_of_shardscorresponds toapack.slice_collection.future.index.number_of_shards. Use the flattened prefix when writing the setting. When you read it back by usingGET /_slice_collection/{collection}, it is displayed as a nested structure, such as"future_only_settings": {"index": {"number_of_shards": "4"}}.
A successful response is {"acknowledged": true}. acknowledged=false indicates that the wait for acknowledgment timed out. It does not indicate that the update was rolled back.
Update the Mapping and dynamic settings
Update the Mapping by using the Collection name:
PUT /knowledge-chunks/_mapping
{
"properties": {
"channel": { "type": "keyword" }
}
}Update dynamic index settings by using the Collection name. The following example resets the refresh interval to the default value 5s. You do not need to explicitly configure this default value when you create the Collection. The change affects the entire Collection. For usage conditions, see Refresh and query visibility:
PUT /knowledge-chunks/_settings
{
"index.refresh_interval": "5s"
}The Mapping and dynamic index settings are applied to all current Backings and become the unified configuration for subsequent Backings. All Slices in the same Collection share these configurations. You cannot separately modify the field type or index settings for a specific Slice. Do not modify Backing Indexes individually.
To verify that a change took effect, call GET /_slice_collection/{collection} and read back the latest_backing value. The mappings field reflects the current Mapping, and the settings field reflects the current index settings.
Pre-create Backings
By default, the system creates Backing Indexes on demand. When you register a new Slice, if all existing Backings have reached their capacity thresholds, the system performs automatic creation of the next Backing. Before you enable a large number of tenants or import data in batches, you can prepare these underlying indexes in advance to reduce the latency of waiting for index creation when the first batch of Slices is registered.
Pre-creating Backings and registering Slices are separate operations. The former prepares indexes for data storage, whereas the latter creates business partitions that applications access. Pre-creation does not automatically register tenant Slices or move existing data. An account that has the Collection manage privilege can call this API. For the complete privilege configuration, see Collection privileges.
Pre-create Backings and view the result
Create the Collection first, and then run the following request:
PUT /_slice_collection/knowledge-chunks/backings?count=5Alternatively, use the equivalent request body syntax. Use one of the two methods:
PUT /_slice_collection/knowledge-chunks/backings
{
"count": 5
}count is a required integer and can be provided only once, either as a query parameter or in the request body. A request that provides the value in both places is rejected even if the values are identical. Valid values: 1 to 99999. This API also supports master_timeout.
count=5 means ensure that the first five Backings of the Collection exist, rather than add five more Backings each time. If only the first Backing previously existed, the request creates the other four. The following sample response illustrates this case. The ellipsis characters in the names represent system-generated content and cannot be used directly in requests:
{
"acknowledged": true,
"backings": [
".sc-knowledge-chunks-...-00000",
".sc-knowledge-chunks-...-00001",
".sc-knowledge-chunks-...-00002",
".sc-knowledge-chunks-...-00003",
".sc-knowledge-chunks-...-00004"
],
"created_backings": [
".sc-knowledge-chunks-...-00001",
".sc-knowledge-chunks-...-00002",
".sc-knowledge-chunks-...-00003",
".sc-knowledge-chunks-...-00004"
],
"existing_backings": [
".sc-knowledge-chunks-...-00000"
]
}backings lists the Backings involved in this request. created_backings lists the Backings added by this request, and existing_backings lists the Backings that already existed. These lists do not necessarily constitute the complete list of Backings in the Collection. Use the following API to view the current list:
GET /_cat/slice_collection/knowledge-chunks/backings?vOptional: View the current Collection configuration.
GET /_slice_collection/knowledge-chunksEffects on subsequent Slice allocation
Whencount > 1, the pre-creation API automatically changesbacking_allocation_strategytorandom so that subsequently registered Slices randomly select Backings that still have capacity. This policy is updated even if all Backings involved in this request already exist. You can use the preceding GET Collection request to confirm the change.
The following adjustment is optional. Call the update API after pre-creation only if your business still needs to preferentially use the latest Backing. Skip this request if you use random allocation.
POST /_slice_collection/knowledge-chunks/_update
{
"backing_allocation_strategy": "last"
}For batch enablement, we recommend that you then prepare known tenants as described in Register Slices before you import documents. If automatic registration is enabled, you can also write data directly. Pre-creation only prepares Backings. It does not add index nodes or query nodes to the instance or rebalance existing Slices.
Retries and capacity planning
Repeatedly using the same
countvalue only checks and completes the same set of Backings. Passing a smallercountvalue does not delete excess Backings and therefore cannot be used to scale in.After a request times out or the connection fails, Backings that were already created may still exist. Query the list first, and then retry with the same
countvalue.This operation does not migrate existing Slices or change the allocation results of existing Slices.
Each Backing is an independent Elasticsearch index and consumes primary shard, replica, and cluster metadata resources. Estimate the required number based on the actual number of Slices and capacity parameters. Do not reserve far more Backings than needed.
Backing names in the response are used only to confirm the execution result. Do not use them as targets for subsequent application requests.
Newly created Backings use the current Collection Mapping and future-effective settings. If you want subsequent Backings to use a new number of shards, first make the change as described in Update a Collection, and then pre-create the Backings.
Register Slices
Refer to the following table when you select a registration method.
Method | Scenario |
Automatically register upon write | Slices in namespace mode appear dynamically as the business grows, and the business can tolerate the additional latency of the first write. |
Explicitly register one Slice | The scenario applies if |
Register Slices in batches | Enable tenants or import data in batches, or prepare a large number of known Slices before traffic arrives. |
Register a Slice
PUT /_slice_collection/knowledge-chunks/slices/tenant-cThis API supports master_timeout. Sample response:
{
"acknowledged": true,
"errors": false,
"items": [
{
"slice_id": "tenant-c",
"result": "created",
"backing_index": ".sc-knowledge-chunks-...-00000"
}
]
}slice_id is the business Slice name. backing_index is the internal index name and is used only for observation and troubleshooting. Do not use it as the target of subsequent application requests. Document read responses may also contain internal routing identifiers that differ from business names. For more information, see Request targets and response identifiers.
Vector cluster retrieval mode also requires a centroid vector in the request body. For more information, see Vector cluster retrieval reference.
Register Slices in batches
PUT /_slice_collection/knowledge-chunks/slices
{
"slices": [
"tenant-d",
{ "slice": "tenant-e" },
{ "slice_id": "tenant-f" }
]
}This API supports master_timeout. You can mix the three formats in the same request. A single request can register up to 20,480 Slices, and duplicate names are not allowed within a request.
Batch registration may partially succeed. The result of each item can be created, updated, noop, or failed. If any item fails, the top-level errors value is true. If a Slice name is invalid—for example, if its first or last character is not a letter or digit, if the reserved value _all is used, or if it exceeds the length limit—the API still returns HTTP 200 and reports failed and the error cause in the corresponding item. We recommend that you use letters, digits, ., _, and - in names and avoid relying on special characters.
Query a Slice
GET /_slice_collection/{collection}/slices/{slice}Query parameters:
Parameter | Default value | Description |
|
| Specifies whether to return |
Sample response:
{
"slice": "tenant-a",
"backing_index": ".sc-knowledge-chunks-...-00000",
"created_at": "2026-08-12T00:00:00.000Z"
}created_at is the time when the Slice was created, in UTC ISO 8601 format.
To only check whether a Slice exists or read its information, use the preceding default request. include_doc_count=true runs an additional data query to count documents. Do not use it for frequent polling or batch checks of a large number of Slices. Call it only when you need to check the number of searchable documents:
GET /_slice_collection/knowledge-chunks/slices/tenant-a?include_doc_count=trueThe response additionally contains:
{
"docs": {
"count": 12500
}
}Usage notes:
docs.countindicates the current number of searchable documents. Documents that were recently written but not yet refreshed may not be included.This API queries only currently valid Slices. If the Collection or Slice does not exist or the Slice has been deleted, HTTP 404 is returned.
A query does not create a Slice. Explicitly register the Slice first, or write to the Slice first if automatic registration is enabled.
This API does not provide the storage size of a single Slice. To obtain storage statistics, use Backing CAT or the native Index Stats API. For more information, see the Backing CAT and Slice CAT commands.
Shards and replicas are configured at the Backing level. Use Slice CAT to view the primary shards that a Slice actually accesses and Backing CAT to view the replica configuration.
List Slices by page
GET /_slice_collection/knowledge-chunks/slices?prefix=tenant-&page_size=100Parameter | Default value | Description |
|
| The number of items to return on each page. Valid values: 1 to 10000. |
| None | The |
| None | Returns only Slices whose names start with the specified text. |
Sample response:
{
"slices": [
{ "id": "tenant-a" },
{ "id": "tenant-b" }
],
"next_cursor": "opaque-cursor"
}If no next page exists, next_cursor is omitted. Results are returned in ascending order by Slice name. If Slices are concurrently added or deleted during pagination, the paginated results provide weak consistency. Keep the same prefix when you continue pagination.
Delete a Slice
After a Slice is deleted, the Slice and all its documents can no longer be accessed by using the original name. Re-registering a Slice with the same name cannot recover the old data. Confirm the target business space before you run the following request:
DELETE /_slice_collection/knowledge-chunks/slices/tenant-cQuery parameters:
Parameter | Default value | Description |
|
| The maximum amount of time to wait for the master node. The value must be finite and cannot exceed 5 minutes. |
|
| The maximum amount of time to wait for logical deletion and cache invalidation. |
Sample success response:
{
"acknowledged": true
}This response indicates that the original Slice name is no longer accessible. It does not indicate that the old physical data has been completely removed or that storage space has been released. You can subsequently register a Slice with the same name. New data remains isolated from old data that is pending cleanup in the background. The application must coordinate deletion, recreation with the same name, and writes that may trigger automatic registration. If the deletion result is uncertain, first check the Slice lifecycle state. If a Slice with the same name has been recreated, do not blindly resend DELETE by using the original name. Otherwise, the new Slice may be deleted. In addition:
After a Slice is deleted, a query that specifies the Slice name returns HTTP 404 (
resource_not_found_exception) instead of an empty result.Before physical cleanup is complete, a full query that uses
_slice=_allmay briefly return old data. A query for a specific Slice name does not access deleted old data.If you need to delete only one Slice, use this API. Do not delete the entire Collection. To delete a Collection, see Delete a Collection.
Delete a Collection
This API is suitable for decommissioning all business data or removing sample data. Deletion removes the Collection configuration and system-managed data. This operation cannot be undone. If you need to delete only one Slice, use Delete a Slice.
DELETE /_slice_collection/knowledge-chunksQuery parameters: master_timeout and timeout.
Sample success response:
{
"acknowledged": true
}{collection}supports comma-separated names. We recommend that you explicitly specify each Collection to delete. By default, theaction.destructive_requires_namesafeguard rejects the wildcards*and_alland returns HTTP 400. Do not disable this cluster-level safeguard merely to conveniently remove sample data.If a Copy Slice is in the
RUNNINGorCANCELLINGstate, the delete request returns HTTP 409. Canceling a Copy is asynchronous. Confirm thatcompleted=trueand that the Copy has entered a terminal state before you delete the Collection.acknowledged=trueindicates that deletion of the logical resources and metadata is acknowledged. Historical indexes and Translog files in object storage are asynchronously reclaimed by a background process. Physical space is not guaranteed to be released immediately when the response is returned.
Manage Collection Aliases
A Collection Alias provides applications with a stable access name and can be used to query multiple Collections in a unified manner or switch the write target. When you create a Collection, you can add an Alias by using the aliases field. You can also use the standard Elasticsearch _aliases API for management.
Scenarios:
Version migration: The application always accesses a fixed Alias. After data preparation is complete, switch the write target from the old Collection to the new Collection.
Multi-Collection queries: Use one Alias to query multiple Collections that use the same
slice_strategy.Application decoupling: Store only the Alias in business configurations instead of directly depending on Collection names that contain versions or dates.
Before use, check Collection Alias support to confirm that the existing Alias configuration is supported.
For version migration, first complete data migration, handle incremental writes during migration, confirm that data in the new Collection is searchable, and warm up the Slices that will be accessed. Then, in the same request, remove the old Collection from the Alias and add the new Collection to the Alias. Alias updates are atomic, but they do not automatically copy or synchronize data. The following example atomically switches read and write traffic from knowledge-chunks-v1 to knowledge-chunks-v2:
POST /_aliases
{
"actions": [
{
"remove": {
"index": "knowledge-chunks-v1",
"alias": "knowledge-chunks-current"
}
},
{
"add": {
"index": "knowledge-chunks-v2",
"alias": "knowledge-chunks-current",
"is_write_index": true
}
}
]
}The following example is for multi-Collection queries, not version migration. Assume that knowledge-chunks-v1 and knowledge-chunks-v2 are both Collections in namespace mode and that the data in the two Collections does not overlap. Add them to the same Alias and set knowledge-chunks-v2 as the write target. Search queries both Collections.is_write_index determines only the write location and does not limit the query scope.
POST /_aliases
{
"actions": [
{
"add": {
"index": "knowledge-chunks-v1",
"alias": "knowledge-chunks-current"
}
},
{
"add": {
"index": "knowledge-chunks-v2",
"alias": "knowledge-chunks-current",
"is_write_index": true
}
}
]
}View the Alias:
GET /_alias/knowledge-chunks-currentQuery a potentially missing Slice in a multi-member Alias:
GET /knowledge-chunks-current/_search?_slice=tenant-a&ignore_missing_slice=trueTake note of the following when you use an Alias:
When a multi-member Alias is used for writes, exactly one member must have
is_write_index=true.APIs such as Search, Count, and Bulk can access a multi-member Alias according to Alias semantics.
A single-document GET request and each item in an MGet request must resolve to exactly one Collection. Therefore, only a single-member Alias can be used.
is_write_indexdoes not select a member for a single-target read.Alias updates are applied atomically. By default,
removesucceeds if it matches at least one existing member.must_exist=truestrictly validates each specific target. The response contains onlyacknowledgedand does not contain per-action results.When you query a multi-member Alias, the target Slice must exist in all member Collections. Otherwise, HTTP 404 is returned. To query a Slice that may be missing, explicitly include
ignore_missing_slice=true. The request skips members in which the Slice is missing and returns results as normal.