All Products
Search
Document Center

Elasticsearch:Usage guide

Last Updated:Aug 20, 2026

This guide describes how to create and connect to an Alibaba Cloud Elasticsearch AI Engine Edition instance, and how to use Collection, Slice, vector search, and data management APIs.

Workflow

The following table lists the complete path from activation to operations and the corresponding sections for each phase.

Phase

Operation

Section

1 Preparation

Create an AI Engine Edition instance, configure the network, account, index nodes, and search nodes. Connect to the instance and verify account permissions and network connectivity.

Prepare an instance

2 Mode selection

Choose between namespace mode and vector cluster recall mode. The mode cannot be changed after creation.

Select a Collection mode

3 Get started

Create a Collection in your chosen mode, plan Slices, and complete a write and query operation.

Quick start

4 Management

Adjust Collection capacity parameters and mappings. Register, list, and delete Slices.

Manage Collections and Slices

5 Integration

Integrate with your application: batch write data, control Refresh visibility, specify query scope, and Reindex as needed.

Write, read, and query data

6 Enhancement

Use cache warming, DiskBBQ vector indexing, Collection Alias, and Copy Slice as needed.

Advanced features

7 Operations

Monitor the cluster status through cluster monitoring and CAT APIs, configure role permissions, and clean up unused Collections.

Operations and permissions

Reference

Review the differences from traditional Elasticsearch, usage limits, and API list.

References

The examples use the Console syntax supported by Kibana Dev Tools. When you use other HTTP clients, configure the instance address, authentication, and the required TLS parameters.

This guide applies to AI Engine Edition 9.99.0. The request paths, parameters, and usage limits in this guide are based on this version. Other versions may differ. Use the documentation that matches the version shown on the instance in the console.

The examples set index.number_of_replicas to 2 to meet the basic requirements for query high availability. The number of primary shards, vector dimensions, and other capacity parameters are only for API illustration purposes. Production configurations should be based on capacity evaluation and stress testing results.

This guide covers only the commonly used APIs required for application development and daily management, not all APIs. For the product positioning, core architecture, product advantages, common scenarios, and performance reference, see Feature overview.

Prepare an instance

Prerequisites

  • You have activated the Alibaba Cloud Elasticsearch service and have created or plan to create an AI Engine Edition instance.

  • You have planned the VPC, vSwitch, IP address whitelist, and client network for the instance.

  • You have designed the mapping based on your business data. For vector search scenarios, you also need to determine the vector model, dimensions, similarity metric, and update method.

  • Your account has the required permissions. Collection management typically requires manage, data reading requires read, and data writing requires write. For more information, see Collection permissions.

Create an instance

The purchase items and page layout may change based on the region, version, and product phase. The following steps are based on the actual console page. The regions and zones supported by AI Engine Edition are based on the actual purchasable items on the buy page.

  1. Log on to the Alibaba Cloud Elasticsearch console and go to the instance creation page.

  2. Select AI Engine Edition and select the region and zone provided by the console. The Elasticsearch version of this instance type is fixed. The creation page displays version 9.x, which cannot be changed. After the instance is created, you can view the specific version number on the instance list or instance details page.

  3. Configure index nodes based on the write workload and configure search nodes based on the query workload. Other optional components are based on the console.

  4. Configure the VPC, vSwitch, username, and password. The IP address whitelist is not configured on the creation page. You configure it on the security configuration page of the instance after the instance is created.

  5. Confirm the configuration and cost, and then create the instance. After the instance status changes to Available, record the Elasticsearch and Kibana access addresses.

    The node specifications, minimum number of nodes, and dedicated master node configuration are based on the current purchasable items on the buy page.

The number and specifications of nodes should be determined based on write throughput, query concurrency, vector index construction, active datasets, and cache requirements. The specific operations for adjusting nodes and billing rules are based on the console.

Connect to an instance

You can use Kibana Dev Tools, Elasticsearch-compatible clients, or any HTTP client to access the instance. The instance address, network whitelist, certificate, and authentication method are based on the instance details page.

The access domain names of AI Engine Edition vary by network type. The domain name only determines which node role the request initially connects to and does not restrict the request type. The cluster forwards the request to the node role that actually handles it.

Network type

Domain name

Entry node

Request handling

Private network

The default Elasticsearch private network domain name displayed in the console

Search node

Supports read and write. Write requests are forwarded to index nodes for processing.

Private network

{instanceId}-index.elasticsearch.aliyuncs.com

Index node

Supports read and write. Query requests are forwarded to search nodes for processing. Replace {instanceId} with the instance ID.

Public network

The default Elasticsearch public network domain name displayed in the console

Search node

Only this domain name is provided for public network access. It supports read and write. Write requests are forwarded to index nodes for processing.

When you access the instance over a private network, both domain names support read and write operations. For production access, use the default private network domain name for query requests and the index node private network domain name for write requests to reduce network bandwidth consumption on search nodes. This is especially important for Bulk writes, queries that return large results, or high-concurrency scenarios. When you access the instance over the public network, use the default public network domain name for both read and write requests.

For example, if the instance ID is es-cn-xxx, the index node private network domain name is es-cn-xxx-index.elasticsearch.aliyuncs.com. The protocol, port, and network access method are based on the information displayed in the console.

The instance uses HTTP by default. If you enable HTTPS in the console, switch the client connection protocol to HTTPS.

Run the following request in Kibana Dev Tools to verify the connection:

GET /

AI Engine Edition 9.99.0 corresponds to Elasticsearch kernel version 9.5.0. Therefore, the version.number returned by this request is the kernel version number, which differs from the 9.99.0 displayed in the console. The actual Elasticsearch version is based on the cluster API response. When you install custom plugins, use the 9.99.0 version number that matches AI Engine Edition.

When you use cURL, replace the instance address and credentials. For production use, do not store passwords in plaintext in scripts or command history:

curl --user '{username}:{password}' 'http://{elasticsearch-endpoint}/'

When you use an official client, select the client version based on the API compatibility documentation for your instance version, and reuse the client connection pool. Do not create a new client for each request.

Common conventions

The following conventions apply across all Collection, Slice, and document APIs in this guide. Later sections reference them without repeating the details.

Access conventions

  • Applications always access data through the Collection name or Collection Alias.

  • In namespace mode, writes and queries specify the namespace through _slice. Queries that do not provide _slice fail. To query all Slices, explicitly use _slice=_all. Some document and query APIs also support routing as an alternative. For more information about the supported scope, see The routing compatibility parameter.

  • In vector cluster recall mode, writes specify the vector cluster through _slice or routing_field. KNN queries can automatically select multiple candidate Slices based on the query vector. Queries that cannot automatically select candidate Slices still require an explicit _slice, or routing in compatible APIs.

  • Slices are used to organize data and limit query scope. They are not account permission boundaries. To isolate tenant permissions, combine application-level authentication with security mechanisms supported by the product.

  • Do not save or directly access .sc-* backing indexes (Backing Index). Their names and lifecycle are managed by the system. Some API responses (such as _index in write responses and backing_index in Slice registration responses) return these names for observation and troubleshooting only. They should not be used as targets for subsequent application requests. When you configure role permissions, use the .sc-<collection>-* wildcard pattern. For more information, see Collection permissions.

The routing compatibility parameter

When you use the document read/write and query APIs listed in this guide on a Collection or Collection Alias, you can use the standard Elasticsearch routing parameter instead of _slice. This is for compatibility with existing clients. For new applications, use the more semantically explicit _slice. The same URL or the same Bulk or MGet item cannot specify both parameters simultaneously.

This compatibility does not apply to Collection and Slice management, cache warming, Copy Slice, CAT, explicit Refresh, or Reindex. Reindex must use source._slice and dest._slice. routing_field is a configuration for deriving the Slice from a document field, not an alias for routing.

General API conventions

  • JSON requests use Content-Type: application/json. Bulk and Multi Search use Content-Type: application/x-ndjson and require a trailing newline in the request body.

  • Bulk, Multi Search, and batch management APIs may have item-level failures. Applications must not only check the HTTP status code. The single and batch Slice registration APIs also use item-level errors: the overall request returns HTTP 200, but the top-level errors field may be true. Check each items[].result individually.

  • HTTP 429 indicates that the server currently rejects the request. The client should use exponential backoff with an upper limit and only retry operations that are suitable for retry.

  • A connection timeout or HTTP 5xx does not mean the write definitely did not occur. Verify with a stable document ID or other idempotent mechanism before retrying.

  • When you pass a large number of _slice values through the URL, note that the HTTP request line has a maximum length of 4096 bytes. When Slice names are long, too_long_http_line_exception may be triggered before the Slice count limit is reached.

    Collection management APIs commonly use the following query parameters. The specific supported scope is based on each API description.

Parameter

Common default value

Description

master_timeout

30s

The maximum time to wait for the master node to process the request.

timeout

30s

The maximum time to wait for confirmation or the current result.

A management request that returns acknowledged=false or times out does not mean the server-side operation has been rolled back. Check the current resource status before retrying.

Select a Collection mode

Mode comparison

Collection provides namespace mode and vector cluster recall mode. You must choose one of the two modes. The mode is determined by the slice_strategy creation parameter and cannot be changed after creation. It affects the business meaning of Slices, the registration method, and write and query routing.

Item

Namespace mode

Vector cluster recall mode

slice_strategy

exact

vector_cluster

Slice meaning

A namespace identified by a business identifier, such as a knowledge base, code repository, Agent, or tenant.

A vector cluster obtained from offline clustering.

Prerequisite

The application knows the namespace to access before sending a request.

The application can generate and continuously maintain vector clusters and their centroid vectors offline.

Write routing

Specify the namespace through _slice. By default, a Slice can be automatically registered on the first write.

Specify the vector cluster through _slice or routing_field. Typically, register the Slice and its centroid vector first.

Query routing

Explicitly specify one, multiple, or all namespaces through _slice.

KNN queries can automatically select and query multiple candidate Slices based on the query vector. You can also explicitly specify _slice.

Default value of auto_create_slice

true

false

Applicable scenarios

The query scope can be determined based on business identifiers such as tenant ID, knowledge base ID, or code repository ID before the query. For example, multi-tenant RAG only needs to search the current tenant's knowledge base.

Only the query vector is available at query time, and the target data scope cannot be determined in advance. The data has been clustered offline, and the most relevant vector clusters need to be automatically recalled from a large-scale vector database. For example, query similar products in a full product catalog.

Inapplicable scenarios

The query scope cannot be determined in advance, and the system needs to automatically discover relevant vector clusters based on the query vector.

Reliable cluster centroids cannot be provided, the data scale is small, or every query must cover all vector data.

Vector cluster recall mode automatically selects multiple candidate Slices based on the vector cluster centroids and sends queries to these Slices in parallel. This does not mean that you must use this mode to store vectors. Namespace mode also supports dense_vector, KNN, and DiskBBQ. Only choose vector cluster recall mode when your business needs to automatically recall relevant vector clusters and you have completed cluster centroid maintenance and recall rate evaluation.

Decision guidance

Warning

The Collection mode is determined at creation time and cannot be changed later. Switching modes requires creating a new Collection and using Reindex to migrate the data.

Use the following guidance to choose between the two modes:

  • Default recommendation — Choose namespace mode (exact) when the application can determine the query scope from a business identifier (tenant ID, knowledge base ID, code repository ID) before the query.

  • Choose vector cluster recall mode only when all of the following are true:

    • Your business can generate and continuously maintain cluster centroids offline.

    • The data volume and number of Slices are large enough that narrowing the query scope provides tangible benefits.

    • Your business allows selecting candidate clusters before executing the KNN query, and you have determined the appropriate number of candidate Slices through recall rate testing.

  • Do not use vector cluster recall mode when:

    • The data does not have a stable clustering structure, and reliable centroid vectors cannot be provided.

    • The data volume or number of Slices is small, and the cost of direct queries is already acceptable.

    • Queries must cover all vector data, and the recall scope changes introduced by candidate cluster selection are unacceptable. In this case, use namespace mode and explicitly specify the _slice query scope.

    After you select namespace mode, see Namespace mode: DiskBBQ vector search by Slice. After you select vector cluster recall mode, see Vector cluster recall mode: Automatic candidate Slice selection. The other Collection management, data APIs, cache warming, Alias, Copy Slice, and monitoring capabilities in this guide apply to both modes unless otherwise specified.

Query replicas and high availability

Queries in both modes are served by replica shards on search nodes. index.number_of_replicas must be set to at least 1. Otherwise, queries cannot be served. Setting it to 1 only meets the basic query requirement and does not provide query high availability. For production, set it to at least 2 and configure at least two search nodes so that queries can continue to be served when a single search node fails.

Quick start

Namespace mode: DiskBBQ vector search by Slice

An enterprise knowledge base platform provides retrieval-augmented generation (RAG) services for multiple tenants. After the application completes tenant authentication, it can determine the current tenant ID. When a user submits a question, the application only needs to recall semantically relevant content segments from that tenant's knowledge base.

This scenario can determine the query scope before sending the request, making it suitable for namespace mode. This example creates a Collection named knowledge-chunks and uses each tenant as a Slice. The application specifies the tenant knowledge base through _slice and then uses DiskBBQ to perform KNN within the selected Slice. Slices are used to organize data and limit query scope. Tenant authentication is still handled by the application or supported Elasticsearch security mechanisms.

Step 1: Create a namespace mode Collection

PUT /_slice_collection/knowledge-chunks
{
  "settings": {
    "index.number_of_shards": 2,
    "index.number_of_replicas": 2
  },
  "mappings": {
    "properties": {
      "tenant_id": { "type": "keyword" },
      "document_id": { "type": "keyword" },
      "title": { "type": "text" },
      "content": { "type": "text" },
      "category": { "type": "keyword" },
      "updated_at": { "type": "date" },
      "embedding": {
        "type": "dense_vector",
        "dims": 4,
        "index": true,
        "similarity": "cosine",
        "index_options": {
          "type": "bbq_disk"
        }
      }
    }
  }
}

The following result is returned. acknowledged being true indicates that the Collection metadata is created.

{
  "acknowledged": true
}

exact is the default strategy, and auto_create_slice is enabled by default. Therefore, when you write to a nonexistent Slice for the first time, the system automatically registers the Slice without requiring a prior call to the registration API.

Step 2: Write data to different Slices

Write a knowledge base content segment to tenant-a:

PUT /knowledge-chunks/_doc/chunk-1001?_slice=tenant-a
{
  "tenant_id": "tenant-a",
  "document_id": "doc-refund-policy",
  "title": "Refund and return policy",
  "content": "You can request a refund for duplicate purchases within seven days after the order is completed.",
  "category": "after-sales",
  "updated_at": "2026-07-30T10:00:00Z",
  "embedding": [0.82, 0.10, 0.05, 0.03]
}

Write another knowledge base content segment to tenant-b:

PUT /knowledge-chunks/_doc/chunk-1002?_slice=tenant-b
{
  "tenant_id": "tenant-b",
  "document_id": "doc-shipping-status",
  "title": "Check shipping status",
  "content": "Open the logistics information on the order details page to view the latest delivery status.",
  "category": "shipping",
  "updated_at": "2026-07-30T10:01:00Z",
  "embedding": [0.12, 0.78, 0.06, 0.04]
}

The document _id only needs to be unique within the same Slice. The same _id can appear in different Slices.

Step 3: Read data and perform vector search within a Slice

Read the specified document in tenant-a:

GET /knowledge-chunks/_doc/chunk-1001?_slice=tenant-a

The dense_vector field is not included in the returned _source by default. To return vector values, explicitly specify _source_includes, for example, GET /knowledge-chunks/_doc/chunk-1001?_slice=tenant-a&_source_includes=embedding. The returned values are in float32 precision and may differ slightly from the written decimal literals.

Vector queries depend on the data being Refreshed. After writing data, wait for at least one automatic Refresh cycle before running the following query. You can check the current automatic Refresh interval through GET /knowledge-chunks/_settings and view the value of index.refresh_interval.

Run a DiskBBQ KNN query only in tenant-a:

POST /knowledge-chunks/_search?_slice=tenant-a
{
  "knn": {
    "field": "embedding",
    "query_vector": [0.80, 0.12, 0.05, 0.03],
    "k": 10,
    "num_candidates": 100
  },
  "_source": ["document_id", "title", "content"]
}

In this request, the application specifies the Slice through _slice=tenant-a. DiskBBQ only performs vector search within the selected Slice and does not automatically select other Slices based on the query vector. This is the key difference between namespace mode and vector cluster recall mode.

For the syntax and usage limits of multi-Slice and full-scope queries, see Specify the query scope.

Step 4: Batch write

Each item in a Bulk request can specify its own _slice:

POST /_bulk
{ "index": { "_index": "knowledge-chunks", "_id": "chunk-1003", "_slice": "tenant-a" } }
{ "tenant_id": "tenant-a", "document_id": "doc-change-address", "title": "Change delivery address", "content": "Before an order is shipped, you can change the delivery address on the order details page.", "category": "orders", "updated_at": "2026-07-30T10:02:00Z", "embedding": [0.75, 0.16, 0.06, 0.03] }
{ "index": { "_index": "knowledge-chunks", "_id": "chunk-1004", "_slice": "tenant-b" } }
{ "tenant_id": "tenant-b", "document_id": "doc-invoice", "title": "Request an electronic invoice", "content": "After an order is completed, you can request an electronic invoice on the invoice management page.", "category": "billing", "updated_at": "2026-07-30T10:03:00Z", "embedding": [0.18, 0.70, 0.08, 0.04] }

Bulk requests may partially succeed. The caller must check the top-level errors field and the result or error of each item.

Documents that were just written may not yet appear in query results or CAT document counts. To verify immediately, wait for at least one automatic Refresh cycle.

Step 5: Verify the Collection and Slices

View the overall status of the Collection:

GET /_cat/slice_collection/knowledge-chunks?v

View the Backing Index and document count for each Slice:

GET /_cat/slice_collection/knowledge-chunks/slices?v

To obtain the complete Slice list in a structured and paginated way, use the list Slices API:

GET /_slice_collection/knowledge-chunks/slices?page_size=100

Response example:

{
  "slices": [
    { "id": "tenant-a" },
    { "id": "tenant-b" }
  ]
}

If the response contains next_cursor, pass it as-is to the next request:

GET /_slice_collection/knowledge-chunks/slices?page_size=100&cursor={next_cursor}

Verify success and clean up

  • Success signals — The list Slices response contains both tenant-a and tenant-b. The CAT Slice output shows docs.count of at least 1 for each Slice. The DiskBBQ KNN request in Step 3 returns hits with the expected _source fields.

  • Common failure points — If the KNN response returns an empty hits array immediately after writing, the data may not yet be Refreshed. Wait at least one index.refresh_interval cycle, or use refresh=wait_for when writing.

  • Clean up example data — To remove the example Collection, see Delete a Collection.

Vector cluster recall mode: Automatic candidate Slice selection

An e-commerce search platform maintains a large-scale product vector database and has divided products into thousands of vector clusters through offline clustering. When a user initiates a similar product query, the application only has the query vector and cannot determine the target clusters in advance. Querying all product data each time increases the query scope and resource overhead as the data scale grows.

This scenario is suitable for vector cluster recall mode: each Slice corresponds to a vector cluster, and the centroid vector of that cluster is registered. When a KNN query is executed, the system first calculates the similarity between the query vector and each cluster centroid, automatically selects the most relevant candidate Slices, and then performs DiskBBQ search in parallel within these Slices, thereby narrowing the query scope.

Collections do not train cluster centroids, nor do they automatically determine the target Slice based on document vectors. The application must compute and register centroid vectors in advance.

For when to use and when to avoid this mode, see Decision guidance.

Step 1: Create a vector cluster recall mode Collection

PUT /_slice_collection/products
{
  "slice_strategy": "vector_cluster",
  "auto_create_slice": false,
  "settings": {
    "index.number_of_shards": 2,
    "index.number_of_replicas": 2
  },
  "mappings": {
    "properties": {
      "cluster_id": { "type": "keyword" },
      "name": { "type": "keyword" },
      "embedding": {
        "type": "dense_vector",
        "dims": 2,
        "index": true,
        "similarity": "cosine",
        "index_options": {
          "type": "bbq_disk"
        }
      }
    }
  },
  "config": {
    "routing_field": "cluster_id",
    "vector_dims": 2,
    "default_query_vector_path": "knn.query_vector",
    "default_query_slice_count": 128,
    "max_query_slice_count": 512
  }
}

config parameter

Required

Description

routing_field

No

Reads the Slice from a top-level field in the written document. Nested paths in the a.b format are not supported.

vector_dims

Yes

The dimensions of the Slice centroid vector. Valid values: 1 to 4096.

default_query_vector_path

Yes

The path of the query vector in the request. Supported values: knn.query_vector or knn.N.query_vector.

default_query_slice_count

No

The default number of candidate Slices. Default value: 128. Valid values: 1 to 10000.

max_query_slice_count

No

The maximum number of candidate Slices allowed in a single query. Default value: 512. This value cannot be less than the default candidate count and cannot exceed 10000.

Namespace mode (exact) does not accept a non-empty config. Otherwise, HTTP 400 is returned.

Step 2: Register Slice centroid vectors

Register a single vector cluster centroid:

PUT /_slice_collection/products/slices/cluster-a
{
  "vector": [0.9, 0.1]
}

Offline clustering tasks typically generate multiple vector cluster centroids at the same time. You can use the batch API to register them at once:

PUT /_slice_collection/products/slices
{
  "slices": [
    {
      "slice_id": "cluster-b",
      "vector": [0.1, 0.9]
    },
    {
      "slice_id": "cluster-c",
      "vector": [0.6, 0.4]
    }
  ]
}

The batch API can register up to 20480 Slices with unique names at a time.

Both the single registration API and the batch registration API use item-level errors: even if the centroid vector dimensions do not match config.vector_dims, the request still returns HTTP 200. Check the top-level errors and the result of each items element to determine whether the registration was successful. A successful HTTP request does not mean all vector clusters were registered.

The dimensions of each centroid vector must match config.vector_dims. A Slice without a centroid vector can still be accessed explicitly, but it will not participate in automatic candidate Slice selection.

Step 3: Write vector data

This example configures routing_field=cluster_id, so the system can read the Slice from the top-level field of the document without requiring _slice:

PUT /products/_doc/product-1
{
  "cluster_id": "cluster-a",
  "name": "example-product",
  "embedding": [0.92, 0.08]
}

You can also explicitly provide _slice=cluster-a, or use routing=cluster-a with compatible APIs. When you explicitly specify a Slice, its value must match the value of the routing_field field in the document (in this example, cluster_id). Otherwise, HTTP 400 is returned. Scripted update is not supported when routing_field is configured.

Step 4: Automatic candidate Slice selection

After writing data, wait for at least one automatic Refresh cycle before running the following query.

POST /products/_search?query_slice_count=64
{
  "knn": {
    "field": "embedding",
    "query_vector": [0.91, 0.09],
    "k": 10,
    "num_candidates": 100
  }
}

Parameters for automatic candidate Slice selection:

Parameter

Description

query_slice_count

The upper limit of candidate Slices to select for this query. When omitted or set to 0, the Collection default value is used.

query_vector_path

Overrides the default query vector path of the Collection. Supported values: knn.query_vector or knn.N.query_vector.

query_slice_count cannot exceed max_query_slice_count. Otherwise, HTTP 400 is returned.

Currently, only inline query_vector in the request body is supported for automatic candidate Slice selection. The Count API does not automatically select candidate Slices. You must explicitly provide _slice.

Verify success and clean up

  • Success signals — The KNN response returns hits sorted by similarity score. Registered cluster centroids appear in the response of GET /_slice_collection/products/slices.

  • Common failure points — If the KNN response is empty, verify that refresh_interval has elapsed and that the query vector dimensions match config.vector_dims. If registration returned HTTP 200 but the Slice does not appear, inspect items[].result for failed entries and the associated error reasons.

  • Clean up example data — To remove the example Collection, see Delete a Collection.

Manage Collections and Slices

This section applies to creating new logical datasets or adjusting the capacity and Backing allocation method for subsequent Slices. Capacity parameters determine the allocation of new Slices and do not rebalance existing data.

Creation parameters

The API for creating a Collection is:

PUT /_slice_collection/{collection}

Query parameters:

Parameter

Description

master_timeout

The maximum time to wait for the master node to process the request.

timeout

The maximum time to wait for creation confirmation.

The request body parameters are as follows.

Parameter

Default value

Description

slice_strategy

exact

The Collection mode. Supports namespace mode (exact) and vector cluster recall mode (vector_cluster). This parameter cannot be changed after creation.

auto_create_slice

true for exact; false for vector_cluster

Whether to automatically register a Slice when a write request encounters a nonexistent Slice.

max_slices_per_shard

200

The soft capacity limit for each primary shard to accept new Slices.

max_storage_per_shard

50gb

The soft storage threshold for each primary shard to accept new Slices. Set to 0b to disable this threshold.

backing_allocation_strategy

last

The Backing selection strategy for new Slices. last prefers the most recent available Backing. random selects randomly from available Backings.

settings

{}

The Elasticsearch index settings used by the Backing Index.

mappings

{}

The mapping for the Collection, which is applied uniformly to all Backing Indexes.

aliases

{}

The Collection Alias to create along with the Collection. Only the is_write_index parameter is supported.

config

None

The configuration for vector cluster recall mode (vector_cluster). Namespace mode (exact) does not accept a non-empty config.

If a Backing Index has N primary shards, the maximum number of Slices it can accept based on the count limit alone is N × max_slices_per_shard. max_slices_per_shard and max_storage_per_shard only determine whether subsequent new Slices continue to be allocated to this Backing:

  • After either threshold is reached, the system selects or creates another Backing to host new Slices.

  • Existing Slices can continue to receive writes.

  • Changing the thresholds does not migrate existing Slices or rebalance existing data.

    In most scenarios, the default last is sufficient. Only use random when multiple Backings can accept new Slices simultaneously and you want to distribute newly registered Slices randomly.

View a Collection

View a single Collection:

GET /_slice_collection/knowledge-chunks

View all Collections:

GET /_slice_collection

This API supports the master_timeout query parameter.

{collection} supports comma-separated names and wildcards. An exact name that does not exist returns HTTP 404. A wildcard with no matches returns an empty object.

Response example:

{
  "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,
      "aliases": {}
    }
  }
}

The response may also contain system-managed identifiers and generation fields. Applications should treat them as opaque information and not use them for constructing Backing names or implementing business logic.

Update a Collection

This API is used to adjust the allocation strategy for subsequently registered Slices and does not move existing Slices.

Update the mutable configuration:

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

master_timeout

30s

Wait for the master node to process the request.

timeout

30s

Wait for update confirmation.

preserve_existing

false

When set to true, preserve existing future-only settings.

The updatable fields include:

  • max_slices_per_shard

  • max_storage_per_shard

  • backing_allocation_strategy

  • auto_create_slice

  • Allowed future-only settings in settings

    Future-only settings only affect Backings that are created afterward and do not modify existing Backings. The allowed settings by default are:

  • index.number_of_shards

  • index.routing_partition_size

  • index.number_of_routing_shards

    In _update requests, future-only settings must use the apack.slice_collection.future. prefix. For example, index.number_of_shards corresponds to apack.slice_collection.future.index.number_of_shards. When writing, the flat prefix is used. When reading back through GET /_slice_collection/{collection}, the settings are presented in a nested structure, for example, "future_only_settings": {"index": {"number_of_shards": "4"}}.

A successful response is {"acknowledged":true}. acknowledged=false indicates that the confirmation timed out, not that the update has been rolled back.

Update mappings and dynamic settings

Update the mapping by using the Collection name:

PUT /knowledge-chunks/_mapping
{
  "properties": {
    "channel": { "type": "keyword" }
  }
}

Update the dynamic index settings by using the Collection name:

PUT /knowledge-chunks/_settings
{
  "index.refresh_interval": "5s"
}

Mappings and dynamic index settings are applied to all current Backings and become the unified configuration for subsequent Backings. Do not modify individual Backing Indexes.

Register a Slice

When you choose a Slice registration method, see the following table.

Method

Applicable scenarios

Automatic registration on write

Slices in namespace mode (exact) appear dynamically as the business grows, and the business can accept the additional latency on the first write.

Explicitly register a single Slice

auto_create_slice is disabled, you need to verify the name first, or you need to register centroid vectors for vector cluster Slices.

Batch registration

Batch tenant provisioning, batch data import, or preparing a large number of known Slices before traffic arrives.

When auto_create_slice=false, or when you want to complete resource preparation before writing, you can explicitly register a Slice:

PUT /_slice_collection/knowledge-chunks/slices/tenant-c

This API supports the master_timeout query parameter.

Response example:

{
  "acknowledged": true,
  "errors": false,
  "items": [
    {
      "slice_id": "tenant-c",
      "result": "created",
      "backing_index": ".sc-knowledge-chunks-...-00000"
    }
  ]
}

backing_index is for observation and troubleshooting only and should not be used as a target for subsequent application requests.

Register up to 20480 Slices with unique names at a time:

PUT /_slice_collection/knowledge-chunks/slices
{
  "slices": [
    "tenant-d",
    { "slice": "tenant-e" },
    { "slice_id": "tenant-f" }
  ]
}

This API supports the master_timeout query parameter. The three formats can be mixed in the same request.

Batch registration may partially succeed. The result of each item may be created, updated, noop, or failed. The top-level errors is true as long as any item has failed. When a Slice name is invalid (for example, contains :, starts with a non-alphanumeric character, uses the reserved value _all, or exceeds the length limit), the registration API also returns HTTP 200 and provides failed and the error reason in the corresponding item.

List Slices with pagination

GET /_slice_collection/knowledge-chunks/slices?prefix=tenant-&page_size=100

Parameter

Default value

Description

page_size

100

The number of results per page. Valid values: 1 to 10000.

cursor

None

The next_cursor from the previous page response.

prefix

None

Only return Slices whose names start with the specified text.

Results are returned in ascending order by Slice name. If Slices are concurrently added or deleted during pagination, the results are weakly consistent. Keep the same prefix when continuing to paginate.

Delete a Slice

DELETE /_slice_collection/knowledge-chunks/slices/tenant-c

Query parameters:

Parameter

Description

master_timeout

The maximum time to wait for the master node to process the request.

timeout

The maximum time to wait for deletion confirmation.

Successful response:

{
  "acknowledged": true
}

After the Slice is deleted, a Slice with the same name can be re-registered. New data is isolated from the old data pending cleanup in the background. Note:

  • After a Slice is deleted, queries that specify the Slice name return HTTP 404 (resource_not_found_exception) instead of empty results.

  • Full-scope queries using _slice=_all may briefly return old data before physical cleanup is complete.

  • The deletion response does not indicate that storage space has been released.

Write, read, and query data

Write and read data

Collections reuse Elasticsearch standard document APIs and specify the namespace or vector cluster through _slice. Common APIs are as follows.

Access method

Applicable scenarios

Single-document API

Real-time CRUD operations when the document ID and Slice are known.

Bulk

Batch writing logs or knowledge base content, or writing to multiple Slices in a single batch.

MGet

Reading documents from the same or different Slices in a single request when multiple document IDs are known.

Reindex

Data migration between regular indexes and Collections, or between different Collections.

Operation

API

Write or overwrite a document

PUT /{collection}/_doc/{id}?_slice={slice}

Auto-generate a document ID

POST /{collection}/_doc?_slice={slice}

Create a document only

PUT /{collection}/_create/{id}?_slice={slice}

Get a document

GET /{collection}/_doc/{id}?_slice={slice}

Check if a document exists

HEAD /{collection}/_doc/{id}?_slice={slice}

Get _source

GET /{collection}/_source/{id}?_slice={slice}

Update a document

POST /{collection}/_update/{id}?_slice={slice}

Delete a document

DELETE /{collection}/_doc/{id}?_slice={slice}

Rules:

  • A single-document request can specify only one Slice. Comma-separated values and _all are not allowed.

  • index, create, and update can automatically register a nonexistent Slice when auto_create_slice=true. Read and delete operations do not automatically register Slices. Specifying a nonexistent Slice returns HTTP 404.

  • Some document and query APIs can use routing to represent the logical Slice. For the supported scope and conflict rules, see The routing compatibility parameter.

  • Each Bulk request can auto-register up to 512 different missing Slices. Existing Slices are not counted against this limit.

  • wait_for_active_shards is not used as a condition for waiting for replicas in the AI Engine Edition write pipeline. To wait for a document to be searchable, use refresh=wait_for.

  • The dense_vector field is not included in the returned _source by default. Neither GET /{collection}/_doc/{id} nor GET /{collection}/_source/{id} returns vector values. To return them, explicitly specify _source_includes.

Refresh and query visibility

A successful write request indicates that the data has been persisted, not that the data is queryable by search nodes. AI Engine Edition uses a stateless architecture. Refresh requires the index node to generate and publish a new Commit, and then the search node loads the new searchable version. This is a distributed cross-node operation with higher overhead than a local Refresh in traditional stateful Elasticsearch.

You can query and adjust index.refresh_interval through Collection settings. The current value can be viewed through GET /{collection}/_settings. A shorter Refresh interval increases resource overhead. For production, set it to 5s or higher. If you have low-latency visibility requirements, adjust the value based on your business workload. The actual effective value is based on the current Collection settings. Automatic Refresh can be disabled by setting the value to -1. Before shortening this interval, evaluate the Commit publishing frequency, write throughput, and object storage I/O.

Choose one of the following methods based on your business requirements for query visibility:

Method

Applicable scenarios

Notes

Omit refresh or use refresh=false

Throughput-first scenarios such as continuous Bulk import and log writing.

The write returns immediately. Background Refresh makes the data available in query results.

refresh=wait_for

Read-after-write scenarios where a query must be made immediately after writing.

Waits for the next distributed Refresh without shortening index.refresh_interval. Combine into Bulk requests to avoid large numbers of single-document requests waiting simultaneously.

refresh=true

Low-frequency writes that truly require immediate visibility.

Triggers an immediate distributed Refresh. The response contains "forced_refresh": true and increases the Commit publishing, object storage I/O, and search node refresh overhead. Do not use this as a regular write parameter.

POST /{collection}/_refresh

Low-frequency operations or unified visibility confirmation after batch imports.

Refreshes all current Backings of the Collection. You cannot Refresh a single Slice through _slice (the request returns HTTP 400 with this parameter). The overhead is high when the Collection is large.

index.refresh_interval=-1 disables automatic Refresh. In this case, writes using refresh=wait_for will wait indefinitely until another request triggers an explicit Refresh. Do not combine these settings without an explicit Refresh process. For production, when read-after-write is required, choose between waiting for automatic Refresh or explicit Refresh based on your business latency requirements, and evaluate the distributed Refresh overhead. Refresh only addresses query visibility. It does not mean all query replicas are available and cannot replace query probes and high-availability checks.

Bulk

Each Bulk item can provide its own _slice in the action metadata, as shown in the quick start example. When all items in a batch are written to the same Slice, you can provide a default value in the URL:

POST /knowledge-chunks/_bulk?_slice=tenant-a
{ "index": { "_id": "chunk-2001" } }
{ "tenant_id": "tenant-a", "document_id": "doc-account-security", "title": "Account security settings", "content": "Administrators can enable multi-factor authentication on the security settings page." }

The _slice in the item can override the URL default value. Namespace mode does not derive the Slice from document fields. Even if the document body contains a tenant_id field, the actual write location is still determined by _slice. For error handling, see General API conventions.

Multi Get

MGet is suitable for reading multiple documents with known IDs at once. Each item can access a different Slice:

POST /knowledge-chunks/_mget
{
  "docs": [
    { "_id": "chunk-1001", "_slice": "tenant-a" },
    { "_id": "chunk-1002", "_slice": "tenant-b" }
  ]
}

The _slice in the URL can serve as a default value. Each item can override the default value. Each item must ultimately resolve to a single Slice.

Reindex

Reindex is suitable for migrating data between regular indexes and Collections, or between different Collections. To copy a Slice within the same Collection, use Copy Slice.

When the source is a Collection, you must explicitly specify source._slice in the request body. Otherwise, HTTP 400 is returned. When the destination is a Collection, only one destination Slice can be specified, and the value must use the ={slice} format:

POST /_reindex
{
  "source": {
    "index": "source-knowledge-chunks",
    "_slice": "tenant-a,tenant-b"
  },
  "dest": {
    "index": "target-knowledge-chunks",
    "_slice": "=tenant-archive"
  }
}

The destination Slice is automatically registered if it does not exist. The top-level slices parameter represents the Elasticsearch Reindex parallelism and is unrelated to the number of business Slices. When either side is a Collection, Reindex does not support scripts. When a Collection is the destination, explicit ingest pipelines are not supported.

Query data

Collection queries continue to use Elasticsearch Query DSL. This section covers only the Slice query scope added by AI Engine Edition. For Query DSL and query capabilities not listed in this guide, the actual supported scope of the 9.99.0 instance prevails.

Explicitly specifying _slice in queries applies to both modes. Namespace mode typically requires an explicit query scope. KNN queries in vector cluster recall mode can automatically select multiple candidate Slices. For more information, see Vector cluster recall mode: Automatic candidate Slice selection.

Specify the query scope

Query scope

Applicable scenarios

Example

Single Slice

Single-tenant online queries, searching within a specific namespace

GET /knowledge-chunks/_search?_slice=tenant-a

Multiple Slices

Aggregated queries for a known small number of tenants, cross-namespace queries

GET /knowledge-chunks/_search?_slice=tenant-a,tenant-b

All Slices

Offline analysis, auditing, or explicit full-scope operations queries

GET /knowledge-chunks/_search?_slice=_all

A single query can specify up to 1024 Slices.

In addition to the Slice count limit, note the 4096-byte HTTP request line length limit. When you use long Slice names, too_long_http_line_exception may be returned before reaching 1024. In this case, shorten the Slice names, split into multiple queries, or use _slice=_all.

When the query list may contain nonexistent Slices, use:

GET /knowledge-chunks/_search?_slice=tenant-a,tenant-b&ignore_missing_slice=true

Without this parameter, the entire request returns HTTP 404 if any Slice does not exist. When used with _slice=_all, ignore_missing_slice has no effect and is silently ignored.

The following query APIs also support the same Slice scope parameters:

  • Search and Count

  • Multi search

  • Search template

  • Async search

  • Validate query

  • Search shards

  • Update by query and Delete by query

    Update by query, Delete by query, and Reindex write or delete data and must explicitly specify the target Slice. If no Slice is specified, the request is rejected and returns HTTP 400.

Query all Slices when _slice is omitted

By default, queries in namespace mode require an explicit _slice. If you want read-only queries without _slice to automatically query all Slices, enable the following cluster setting:

PUT /_cluster/settings
{
  "persistent": {
    "apack.slice_collection.search.default_to_all_slices": true
  }
}

After this setting is enabled, the following request is equivalent to explicitly specifying _slice=_all:

GET /knowledge-chunks/_search

This is a cluster-level setting that affects all Collections and only applies to read-only query APIs such as Search and Count. Full-scope queries typically have higher resource overhead than Slice-specific queries. If only a few requests need to query all Slices, continue to use _slice=_all explicitly.

Optimize text search within specific Slices

If keyword or full-text search typically queries only one or a few specific Slices, you can enable index.sliced_postings.enabled when creating the Collection to reduce the range of inverted index data that queries need to access:

PUT /_slice_collection/knowledge-chunks
{
  "settings": {
    "index.sliced_postings.enabled": true
  }
}

This setting defaults to false and can only be configured during Collection creation. It cannot be changed after creation. After enabling this setting, you can still use _slice=_all to query all Slices, but you will not get the primary optimization benefits of limiting the Slice query scope. If your business primarily performs global text searches, keep the default disabled.

After enabling this setting, the completion field is not supported, and setting fielddata=true for text fields is not supported.

Query best practices

  • When you use namespace mode, or when requests do not support automatic candidate Slice selection, explicitly specify one or a few Slices. Avoid using _slice=_all as the default access method.

  • When you use vector cluster recall mode, determine query_slice_count through recall rate and query overhead testing. Do not blindly increase the number of candidate Slices.

  • The query overhead of _all grows with the number of Backings and shards. Evaluate the query scope, timeout, and cluster load before execution.

  • Use ignore_missing_slice=true for optional Slices that may not exist. Do not retry an entire batch because of a single missing Slice.

  • Applications must use a consistent Slice when writing, reading, updating, and deleting the same document.

Advanced features

Warm Slice caches

The _warm_slice API prefetches data that subsequent queries to a specified Slice may access from object storage to the shared cache on search nodes, reducing the first-query latency for cold data. The warming scope includes DiskBBQ vectors, Slice-related inverted index data, doc values, and stored fields, and covers all searchable replicas of the shard where the Slice resides.

Warming is only for cache optimization. It only affects subsequent access speed, does not change query results, and does not guarantee how long data stays in the cache.

Use cases for warming:

  • A user is about to open a knowledge base, code repository, or Agent memory space that has not been accessed for a long time. You can warm the corresponding Slice before the first query.

  • After a batch import or data migration is completed, you can warm the Slices that are about to be activated before switching query traffic.

  • Certain namespaces are known to experience access peaks during specific time periods. You can warm these Slices in advance.

    Active warming is not recommended when data access is unpredictable, when a large number of Slices need to be warmed at once, or when the target Slices are already hot data. Large-scale warming consumes object storage and search node network, cache, and compute resources. It may also evict existing hot data from the cache.

Initiate async warming

By default, warming tasks are submitted asynchronously:

POST /knowledge-chunks/_warm_slice?_slice=tenant-a

The request returns HTTP 200. The status field in the response body is ACCEPTED, and the response includes the task ID for this warming task:

{
  "status": "ACCEPTED",
  "message": "cache warm hint accepted",
  "task": "{nodeId}:{taskId}"
}

Use the following API to query running tasks:

GET /_tasks/{nodeId}:{taskId}

By default, task results are not retained after completion. To query task results after completion, set store_result=true when submitting the task:

POST /knowledge-chunks/_warm_slice?_slice=tenant-a&store_result=true

Async mode does not validate whether the target Slice exists. Initiating async warming for a nonexistent Slice also returns ACCEPTED, but no warming is performed and no error is returned. Batch warming scripts should first confirm the Slice list or use synchronous mode (synchronous mode returns HTTP 404 for nonexistent Slices).

Wait for warming to complete

To directly obtain warming statistics, wait synchronously:

POST /knowledge-chunks/_warm_slice?_slice=tenant-a&wait_for_completion=true&timeout=60s

Query parameters:

Parameter

Required

Default value

Description

slice or _slice

Yes

None

The Slice to warm. When both parameters are present, the values must be the same. Otherwise, HTTP 400 is returned.

wait_for_completion

No

false

Whether to wait for all searchable replicas to return warming results.

store_result

No

false

Whether to retain the result after the task is completed for querying through the Tasks API.

timeout

No

None

The maximum time to wait for shard responses, for example, 60s.

The synchronous response includes standard _shards information and the following statistics fields:

Field

Description

segments_matched

The number of segments in the current searchable data that match the Slice.

docs_read

The number of documents read when planning the warming scope.

ranges_requested

The number of data ranges requested for warming.

ranges_warmed

The number of data ranges warmed.

ranges_skipped

The number of data ranges skipped because the files were merged or deleted.

bytes_requested

The number of bytes requested for warming.

Note the following when you use this API:

  • Each request can specify only one Collection and one Slice. Missing Slices are not automatically registered. _all cannot be used.

  • Concurrent warming requests for the same query shard replica and Slice are merged. You do not need to submit duplicate requests.

  • Warming only processes data that is searchable at the time the request is submitted. New data that becomes searchable afterward is not included in this warming result.

  • ranges_skipped greater than 0 does not necessarily indicate a warming failure. When files are merged or deleted during warming, the corresponding ranges are skipped.

  • Warming consumes object storage read bandwidth and search node resources. For production, use the default async mode and control the number of Slices being warmed simultaneously.

  • When the warming queue is full, the server may reject new requests. The client should use backoff with an upper limit. Do not retry all Slices concurrently immediately.

DiskBBQ vector indexing

DiskBBQ corresponds to the bbq_disk index type of dense_vector. It is a vector indexing capability used within shards, not a third Collection mode. Both namespace mode and vector cluster recall mode can use DiskBBQ. This section describes the configuration and query methods. For the performance reference of AI Engine Edition, see the Feature overview.

Use cases for DiskBBQ:

  • The vector scale is large, and you want to reduce resident memory pressure through disk-native vector indexing.

  • You can use a business evaluation dataset to tune the balance between recall rate, query latency, and data read overhead.

    DiskBBQ is not recommended as the default approach when the dataset is small, exact nearest-neighbor results are required, or recall rate evaluation has not been completed.

Configure the mapping

The namespace mode quick start has already configured DiskBBQ when creating the Collection. For other Collections that do not yet have a vector field, you can add a field by using the Mapping API:

PUT /{collection}/_mapping
{
  "properties": {
    "embedding": {
      "type": "dense_vector",
      "dims": 4,
      "index": true,
      "similarity": "cosine",
      "index_options": {
        "type": "bbq_disk"
      }
    }
  }
}

When you specify only "type": "bbq_disk", the server fills in the remaining index_options default values. You can view the actual effective configuration by reading back the mapping, where rescore_vector.oversample is enabled by default:

{
  "index_options": {
    "type": "bbq_disk",
    "cluster_size": 384,
    "flat_index_threshold": -1,
    "default_visit_percentage": 0.0,
    "rescore_vector": { "oversample": 3.0 },
    "bits": 1
  }
}

The vector dimensions and similarity metric should match the model used to generate the vectors. If you need to switch the index type for existing vector fields, create the target Collection, configure the new mapping, and then use Reindex to migrate the data and re-evaluate.

Execute a KNN query

The following request is based on the data from the namespace mode quick start and uses visit_percentage to adjust the DiskBBQ access range within the specified Slice:

POST /knowledge-chunks/_search?_slice=tenant-a
{
  "knn": {
    "field": "embedding",
    "query_vector": [0.80, 0.12, 0.05, 0.03],
    "k": 10,
    "visit_percentage": 10.0
  },
  "_source": ["document_id", "title", "content"]
}

Parameter

Description

k

The number of nearest neighbors to return.

visit_percentage

The percentage of vectors to visit per shard. Valid values: 0 to 100. Higher values generally improve recall but also increase computation and read overhead. When explicitly set to a value greater than 0, num_candidates no longer determines the access range.

num_candidates

Used to derive the candidate access range when a valid visit_percentage is not explicitly specified.

filter

Adds structured filtering to reduce irrelevant candidates.

rescore_vector

Rescores the candidates obtained from quantized retrieval using the original vectors. This can override the oversample default value in the mapping.

DiskBBQ and vector cluster recall mode operate at different levels: vector cluster recall mode first selects candidate Slices from all vector clusters, and DiskBBQ then executes KNN within the physical shards of these Slices. The two can be used together, but you should control query_slice_count and the vector access range separately to avoid excessive query scope.

Collection Alias

Collection Alias provides applications with a stable access name. It can be used to query multiple Collections uniformly or to switch write targets. You can add an Alias when creating a Collection through the aliases field, or manage Aliases by using the standard Elasticsearch _aliases API.

Use cases for Collection Alias:

  • Version migration: The application always accesses a fixed Alias. After data preparation is completed, switch the write target from the old Collection to the new Collection.

  • Multi-Collection queries: Query multiple Collections that use the same slice_strategy through a single Alias.

  • Application decoupling: Business configurations only save the Alias and do not directly depend on Collection names that contain versions or dates.

    Collection Alias is not applicable if your business relies on Alias filter or routing, or if you want to include both regular indexes and Collections in the same Alias.

The following example assumes that both knowledge-chunks-v1 and knowledge-chunks-v2 are Collections using namespace mode (exact). Add them to the same Alias and set knowledge-chunks-v2 as the write target:

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-current

Remove a member from the Alias:

POST /_aliases
{
  "actions": [
    {
      "remove": {
        "index": "knowledge-chunks-v1",
        "alias": "knowledge-chunks-current"
      }
    }
  ]
}

Note the following when you use Aliases:

  • Members of the same Alias must use the same slice_strategy. Members that use vector cluster recall mode (vector_cluster) must also use the same vector dimensions.

  • 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 multi-member Aliases based on the Alias semantics.

  • Single-document GET and each item in MGet must uniquely resolve to one Collection. Therefore, only single-member Aliases can be used.

  • filter, routing, index_routing, search_routing, is_hidden, and remove_index are currently not supported for Aliases.

    When you query a multi-member Alias, the target Slice must exist in all member Collections. Otherwise, HTTP 404 is returned. During version migration, the Slice sets of the old and new Collections are typically different. In this case, explicitly include ignore_missing_slice=true, for example, GET /knowledge-chunks-current/_search?_slice=tenant-a&ignore_missing_slice=true, so that the request skips missing members and returns normally.

Copy Slice

Copy Slice copies the replicable documents from one Slice to another Slice within the same Collection online. It is suitable for data migration, not for point-in-time snapshots, backups, or atomic traffic switching.

Use cases for Copy Slice:

  • Copy test or verification data for a tenant while maintaining the same Collection mapping as the source Slice.

  • Prepare a new namespace within the same Collection. After the Copy is complete and verified, the application layer switches the access name.

  • Perform online data migration for a Slice while keeping both the source Slice and destination Slice readable and writable.

    Writes may still occur during the Copy. Therefore, the result is not a point-in-time snapshot of the source. For backup, disaster recovery, strict consistent snapshots, or atomic traffic switching, do not use Copy Slice.

Start an async Copy

POST /_slice_collection/knowledge-chunks/slices/tenant-a/_copy/tenant-a-copy?wait_for_completion=false
{
  "workers": 8,
  "batch_size": 5000,
  "requests_per_second": -1
}

Query parameters:

Parameter

Default value

Description

wait_for_completion

true

Whether to wait for the Copy to complete. Set to false for async.

timeout

30s

The wait time for the current HTTP request. Timeout does not stop the background Copy.

The request body parameters are all optional:

Parameter

Default value

Valid values or description

workers

Half the number of processors on the execution node, rounded up

1 to 64.

batch_size

5000

1 to 10000.

requests_per_second

-1

-1 means no rate limiting. You can also set a positive number for rate limiting.

The async request returns HTTP 202 Accepted. Save the copy_id from the response and preferably use the status_url and cancel_url returned by the server:

{
  "copy_id": "tenant-a-copy:1h",
  "completed": false,
  "timed_out": false,
  "state": "RUNNING",
  "source": "tenant-a",
  "target": "tenant-a-copy",
  "workers": 8,
  "progress": { "total": 0, "created": 0, "version_conflicts": 0 },
  "status_url": "/_slice_collection/knowledge-chunks/_copy/tenant-a-copy%3A1h",
  "cancel_url": "/_slice_collection/knowledge-chunks/_copy/tenant-a-copy%3A1h/_cancel"
}

copy_id consists of the destination Slice name and a system-generated suffix that contains URL-reserved characters such as colons. When you manually construct the status query URL, URL encoding is required. Use the status_url and cancel_url directly from the response.

The response for a running Copy includes a progress object. After the Copy ends, this field becomes result and includes a took field (in milliseconds) that represents the elapsed time. The version_conflicts field that is relevant to the document body is located in progress or result.

When you use the default wait_for_completion=true, if the Copy completes within the timeout, the API returns HTTP 200. If the wait times out, the API returns HTTP 202 with timed_out=true, and the background Copy continues.

Query Copy status

GET /_slice_collection/knowledge-chunks/_copy/{copy_id}

state can be RUNNING, CANCELLING, SUCCEEDED, FAILED, or CANCELLED. The status query may return HTTP 200 even when state=FAILED. The caller must check state and error.

Completed status is retained for 1d by default. After that, queries may return HTTP 404. The caller should not use the Copy status API as long-term audit storage.

The retention period is controlled by the dynamic cluster setting apack.slice_collection.copy.reservation_retention. The default value is 1d and the minimum value is 1h:

PUT /_cluster/settings
{
  "persistent": {
    "apack.slice_collection.copy.reservation_retention": "1d"
  }
}

Cancel a Copy

POST /_slice_collection/knowledge-chunks/_copy/{copy_id}/_cancel

Cancellation does not delete the destination Slice or the documents that have already been copied. Cancellation is asynchronous: the API returns HTTP 202 and state changes to CANCELLING. Continue to poll the status until state changes to CANCELLED. At that point, the cancel_url in the response disappears.

Copy data semantics

  • The source Slice and destination Slice must belong to the same Collection and cannot have the same name.

  • The destination Slice is automatically registered if it does not exist, even if the Collection's auto_create_slice=false.

  • When the destination Slice already contains searchable documents, the Copy initiation request is rejected and returns HTTP 409 with error type target_lifecycle_conflict.

  • Copy uses create-only writes and does not overwrite existing documents with the same _id in the destination Slice. Conflicts are counted in version_conflicts, and other documents continue to be copied. After the Copy is completed, check this field and handle same-ID data based on your business requirements.

  • Both the source Slice and destination Slice can be read and written during the Copy. Therefore, the result is not an atomic point-in-time snapshot of the source Slice.

  • The source Slice must retain complete _source to reconstruct documents. Copy is rejected when _source is disabled, synthetic _source is used, a non-empty _source.includes is configured, or _source.excludes cannot be proven safe.

  • Copy is not supported when the source Slice mapping contains inference fields such as semantic_text.

  • Default/final ingest pipelines are not re-executed during the Copy.

  • Documents are re-applied against the current mapping of the destination. For example, newly added multi-fields will be generated in the destination.

    To switch business traffic after the Copy is completed, check the Copy status and result in the application layer, and then switch to the destination Slice through business configuration.

Operations and permissions

Cluster monitoring

In the left-side navigation pane of the instance details page in the console, choose Monitoring and Logs > Cluster Monitoring to view the running metrics of the instance. When you configure alert thresholds, set them based on your business SLO and stress testing baselines. The specific metric names and alert entry points are based on the console.

The following table lists the mapping between common observation targets and console metrics.

Observation target

Console metric

Dimension

Write throughput

Cluster write QPS

Cluster-level

Write latency

Average write latency of the cluster

Cluster-level

Query throughput

Cluster query QPS

Cluster-level

Query latency

Average search latency of the cluster

Cluster-level

CPU utilization

Node CPU utilization (ES business), Node CPU utilization (total)

Node-level

Heap memory utilization

Node heap memory utilization (ES business)

Node-level

Rejections

Write thread pool rejected tasks, Query thread pool rejected requests

Thread pool dimension

The cluster monitoring page groups metrics by category and does not provide role-based grouping for index nodes and search nodes. To observe the two types of nodes separately, switch Resource Type to Specified Node and then filter by node name: index node names contain -index-, and search node names contain -search-. AI Engine Edition does not have warm nodes. You only need to monitor the index nodes, search nodes, and the monitoring metrics actually provided by AI Engine Edition.

CAT API

CAT API is suitable for manual observation and troubleshooting. For a daily overview, start with the Collection. When capacity or shard anomalies occur, check the Backing. To locate the data distribution and document count of a specific namespace, check the Slice. Applications should not rely on CAT output for business requests.

Observation level

API

Key information

Collection

GET /_cat/slice_collection[/{name}]

Lifecycle status, number of Backings, number of Slices, capacity, document count, and storage size

Backing

GET /_cat/slice_collection/{collection}/backings[/{backing}]

Health status, whether new Slices are being accepted, shards, replicas, capacity, and unassigned shard count

Slice

GET /_cat/slice_collection/{collection}/slices[/{slice}]

Backing of the Slice, target shards, replica count, and document count

Default columns:

Observation level

Default columns

Collection

collection, state, backings, slices, capacity, remaining, docs.count, pri.store.size, store.size

Backing

backing, health, assign, pri, rep, slices, capacity, remaining, docs.count, pri.store.size, store.size, unassigned

Slice

slice, backing, shardIds, rep, docs.count

Common query parameters:

Parameter

Description

v

Whether to display the header.

format

The output format, such as json, yaml, or text.

h

Return only the specified columns.

s

Sort by the specified columns.

bytes

Specify the unit for storage sizes.

help

Display available columns.

Slice CAT also supports backing={backing} to narrow the scope to a specific full Backing name. Sorting across all Backings by docs.count is a high-cost query and requires explicitly setting allow_expensive_search=true.

For programmatic processing, use format=json and explicitly specify the columns:

GET /_cat/slice_collection/knowledge-chunks?format=json&h=collection,state,backings,slices,docs.count,pri.store.size

CAT API is designed for manual troubleshooting and bounded operations queries:

  • Slice CAT returns a maximum of 10000 rows. When the limit is exceeded, an HTTP Warning header indicates that the results are incomplete.

  • When you need a complete and stable paginated Slice list, use GET /_slice_collection/{collection}/slices.

  • docs.count is near-real-time data. Documents that have been written but not yet refreshed may not be counted.

  • pri.store.size and store.size represent the indexed data size, which is not equivalent to the local disk usage on stateless nodes. They also do not include historical data in object storage that is pending cleanup.

Delete a Collection

This API is applicable to taking business data offline or cleaning up the examples in this guide. Deletion removes the Collection configuration and system-managed data. This operation is irreversible. To clean up only a specific Slice, use the delete Slice API.

DELETE /_slice_collection/knowledge-chunks

Query parameters:

Parameter

Description

master_timeout

The maximum time to wait for the master node to process the request.

timeout

The maximum time to wait for deletion confirmation.

Successful response:

{
  "acknowledged": true
}

{collection} supports comma-separated names. By default, wildcards * and _all are not allowed. The request returns HTTP 400. To use them, adjust the action.destructive_requires_name cluster setting.

Deletion returns HTTP 409 when a Copy Slice operation is running or being cancelled. Cancellation is asynchronous. Deletion will still be rejected until state changes to CANCELLED. Confirm that state=CANCELLED before executing the deletion.

acknowledged=true indicates that the logical resource and metadata deletion has been confirmed. 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.

Collection permissions

Operation

Required permissions

Create, update, or delete a Collection or Slice

Index permission manage on the Collection

Call POST /{collection}/_warm_slice to warm a Slice

Index permission manage on the Collection

Use GET /_tasks/{taskId} to query an async warming task

Cluster permission monitor

Call POST /{collection}/_refresh to explicitly Refresh the Collection

Index permission maintenance on the Collection

Start or cancel a Copy Slice

Index permission manage on the Collection

Get a Collection, list Slices, use CAT, or query Copy status

Index permission monitor on the Collection

Document read/write and queries

Corresponding index permissions read or write

Create and modify a Collection Alias

Index permission manage on both the Collection name and the Alias name

When you configure roles, the index name must include both the Collection name and the corresponding Backing wildcard:

<collection>
.sc-<collection>-*

For example, if the Collection name is knowledge-chunks, configure both knowledge-chunks and .sc-knowledge-chunks-* in the role. Configuring only the Collection name causes operations such as single-document read/write, MGet, explicit Refresh, and _update_by_query to return HTTP 403.

.sc-* is only for permission configuration. Applications should still access data through the Collection name and should not directly access or save specific Backing Index names.

Slices are not tenant permission isolation boundaries. To isolate permissions, implement this at the application layer or through other supported Elasticsearch security models.

References

AI Engine Edition 9.99.0 uses a stateless architecture and does not fully inherit all features, index settings, and operations methods of traditional stateful Elasticsearch. The following content only lists the common and high-impact differences during migration, not a complete list of all incompatible features. The absence of a capability from this table does not mean it is supported. Before using any Elasticsearch API, index setting, or operations feature not described in this guide, confirm the actual supported scope of the instance and validate with real business data.

Common differences from traditional stateful Elasticsearch

Settings marked as inapplicable in the following table may return HTTP 200 when modified, and the new value may be visible when read back. This does not indicate that the feature is enabled.

Traditional stateful Elasticsearch capability or setting

Differences in AI Engine Edition 9.99.0

Recommendation

Index Lifecycle Management (ILM), _ilm/*, and index.lifecycle.*

ILM policy management and execution are not supported. The related APIs are not registered. index.lifecycle.name is an unrecognized setting. Existing ILM policies cannot be directly migrated.

For log and time-series data, use Data Stream Lifecycle when the instance supports the capability. For regular indexes, use an external scheduler to call Rollover, Delete Index, and other APIs supported by the instance.

hot, warm, cold, frozen data tiers and _tier_preference-based migration

The traditional data_* data tiers and tier migration model are not used. The _tier_preference setting is inapplicable and has no effect.

Use object storage to persist data. Separately plan index nodes and search nodes. Manage historical data based on your business retention policy, and use downsampling when the instance supports the capability.

Watcher

The Watcher trigger, condition, and notification execution chain is not supported. The related APIs are not registered.

Use CloudMonitor, Log Service (SLS) alerts, enterprise alert platforms, or external scheduled tasks.

Legacy Stack Monitoring local collection pipeline

The collection method that depends on xpack.monitoring.collection.* and local .monitoring-* indexes is not supported. The related cluster settings are inapplicable and have no effect.

Use console monitoring and logs. When application-side observation is needed, use the cluster and node statistics APIs supported by the instance.

Rollup Job and _rollup_search

The legacy Rollup tasks and their query API are not supported. The related APIs are not registered.

Choose Downsample, Transform, or external aggregation tasks based on the data type, and base your implementation on the APIs supported by the instance.

Searchable Snapshots, snapshot mounting, and frozen tier transitions

The Searchable Snapshot mounting semantics are not supported. The mounting API is not registered, and the frozen tier process cannot be reused.

Use the object storage native index for online data. For backup and restore, use standard Snapshot/Restore when the instance supports the capability.

index.auto_expand_replicas

Query replicas are not automatically adjusted based on the number of search nodes. This setting is inapplicable and does not expand replicas automatically.

Explicitly configure index.number_of_replicas and adjust search nodes based on query capacity and high-availability requirements.

index.translog.durability=async

Setting Translog durability to async is not supported. The modification request is rejected. Write confirmation uses request durability.

Optimize write throughput through Bulk size, concurrency, refresh frequency, shard planning, and index node capacity.

wait_for_active_shards

Not used as a replica waiting condition in the AI Engine Edition write pipeline. Even when set to all, it does not mean all query replicas are available.

Check write responses separately, use refresh=wait_for to verify query visibility, and confirm query service readiness through real query probes.

Additionally, replicas in the stateless architecture are primarily used for queries and caching. They are not equivalent to the persistent replicas in traditional stateful Elasticsearch that can be promoted to primary shards. The number of query replicas and search nodes together determine query capacity and availability. Persistent data is stored in object storage. Increasing the number of replicas cannot replace a backup strategy.

Limitations when using Collections and Slices

The following limitations apply only to the Collection and Slice usage in AI Engine Edition. They do not mean the same-named capabilities are also unavailable for regular indexes.

Name and batch limits

Item

Limit

Collection name

Follows Elasticsearch index and Alias naming rules. Must be lowercase. Length cannot exceed 128 bytes. The system-reserved .sc- prefix cannot be used.

Slice name

Length: 1 to 128 characters. The first and last characters must be alphanumeric. Middle characters can be alphanumeric, ., _, or -. Cannot contain :. _all is a reserved value.

Slices per single Search request

Up to 1024, also subject to the 4096-byte HTTP request line length limit.

Missing Slices auto-created per single Bulk request

Up to 512.

Slices per single batch registration

Up to 20480, with no duplicate names within the request.

page_size for the list Slices API

1 to 10000.

Rows returned by Slice CAT

Up to 10000, with no pagination.

Collection and Slice API limitations

The following are common API boundaries when using Collections and Slices. This is not a complete support list for all AI Engine Edition features.

  • DLS/FLS cannot be used with Collections. A role with DLS/FLS restrictions can be created, but users with that role will receive HTTP 403 when accessing Collections.

  • Collections do not support cross-cluster search (CCS).

  • Point in Time (PIT) cannot directly target a Collection.

  • _graph/explore and _termvectors cannot target a Collection. _mtermvectors also cannot include Collection items.

  • Collections do not support the deprecated _knn_search. Use knn in _search requests instead.

  • Vector cluster recall mode can automatically select candidate Slices only when the request provides an inline query vector.

  • Scripted update is not supported when routing_field is configured.

  • Collection Reindex does not support scripts. When a Collection is the destination, explicit ingest pipelines are not supported. The remote source does not support source._slice.

  • Copy Slice does not support cross-Collection operations, atomic traffic switching, or dynamically adjusting workers during execution.

  • Copy Slice is not supported when the source Slice mapping contains inference fields such as semantic_text.

  • Slice CAT does not support pagination, per-Slice storage size statistics, or sorting by Slice storage size.

API quick reference

The following is a summary of the 9.99.0 public APIs required for the use cases in this guide. This is not a complete Elasticsearch API list, nor does it include internally maintained APIs.

Purpose

API

Create a Collection

PUT /_slice_collection/{collection}

Get a Collection

GET /_slice_collection[/{collection}]

Update a Collection

POST /_slice_collection/{collection}/_update

Delete a Collection

DELETE /_slice_collection/{collection}

Register a single Slice

PUT /_slice_collection/{collection}/slices/{slice}

Batch register Slices

PUT /_slice_collection/{collection}/slices

List Slices with pagination

GET /_slice_collection/{collection}/slices

Delete a Slice

DELETE /_slice_collection/{collection}/slices/{slice}

Single-document read/write

/{collection}/_doc, /{collection}/_create, /{collection}/_update, /{collection}/_source; use HEAD /{collection}/_doc/{id} to check if a document exists

Batch write and read

POST /_bulk, POST /{collection}/_bulk, POST /{collection}/_mget

Query and count

POST /{collection}/_search, POST /{collection}/_count, POST /_msearch, POST /{collection}/_msearch

Other query APIs

POST /{collection}/_search/template, POST /{collection}/_async_search, GET /_async_search/{id}, DELETE /_async_search/{id}, POST /{collection}/_validate/query, GET /{collection}/_search_shards

Warm Slice caches

POST /{collection}/_warm_slice?_slice={slice}

Query warming tasks

GET /_tasks/{taskId}

Update or delete by query

POST /{collection}/_update_by_query, POST /{collection}/_delete_by_query

Reindex

POST /_reindex

Update mappings

PUT /{collection}/_mapping

Update dynamic settings

PUT /{collection}/_settings

Explicit Refresh

POST /{collection}/_refresh

Manage Collection Aliases

POST /_aliases, GET /_alias[/{alias}]

Start a Copy Slice

POST /_slice_collection/{collection}/slices/{source}/_copy/{target}

Query Copy status

GET /_slice_collection/{collection}/_copy/{copy_id}

Cancel a Copy

POST /_slice_collection/{collection}/_copy/{copy_id}/_cancel

Collection CAT

GET /_cat/slice_collection[/{name}]

Backing CAT

GET /_cat/slice_collection/{collection}/backings[/{backing}]

Slice CAT

GET /_cat/slice_collection/{collection}/slices[/{slice}]

Cluster and node observation

GET /_cluster/health, GET /_nodes/stats, GET /_tasks