Use ES Agent

Updated at:

This topic describes how to use ES Agent for day-to-day operations, including running cluster diagnostics through natural language conversations, using Data Insights to query and analyze index data in natural language, handling typical scenarios such as alert response and capacity planning, and configuring scheduled tasks (inspection tasks and event alert tasks) and IM notification channels for automated inspection and real-time event push.

Before you begin, complete the environment preparation and confirm the required permissions. For more information, see the Prerequisites and Permissions sections in ES Agent.

Quick Start

Complete the following steps to start using ES Agent:

  1. Log on to the Alibaba Cloud Elasticsearch console.

  2. In the left-side navigation pane, click AI Assistant. On first access, follow the on-screen prompts to complete the ES Agent activation flow and the RAM role authorization. After activation, you receive the free quota.

  3. In the Quick Actions area, click a preset button such as Instance Diagnosis, or type your question directly in the input box at the bottom and press Enter to send it.

  4. After you send the first message, the conversation displays the Review and complete the following information for more accurate issue resolution. card. On the card, select the target Region and Instance ID, and then click Confirm to trigger the first diagnosis.

Note

When you open the assistant from the right-side floating entry on an instance details page, the region and the instance ID on the card are populated automatically. In addition, if you write the target instance ID such as es-cn-xxxxxxxx directly in your question, the assistant recognizes it and uses it as the context.

The entire process takes about 1 minute, after which you will receive your first diagnostic result.

Home Page Layout

After opening the ES Agent assistant panel, the home page displays the following areas:

Area

Description

Welcome Area

Displays a summary of the assistant's capabilities and guides you to start a conversation through quick operations or direct questions.

Context Card

Displayed in the conversation after you send the first message. Select Region and Instance ID as the context for the rest of the conversation. The values are populated automatically when the assistant is opened from the instance details page. If the drop-down lists are empty, check whether you have the elasticsearch:ListInstance permission.

Quick Operations

Five preset entry cards: Instance Management (scale up, upgrade, restart instance), Network Management (whitelist, public network access configuration), Instance Diagnosis (cluster health check and fault analysis), Data Insights (query, analysis, charts, and controlled writes), and Product Consultation (usage consultation, specification recommendation). Click to enter the corresponding Skill.

Frequently Asked Questions

Paginated typical operations question tags, for example Node Offline / Frequent Restarts, six per page. Clicking a tag automatically completes it into a full question by appending , locate and resolve the issue, and starts the conversation.

Recent Conversations

The left sidebar lists historical conversations in reverse chronological order. Click a conversation to restore its context and continue it. When a conversation is selected, that entry also shows the number of tokens the conversation has consumed.

New Session

The + button at the top of the recent sessions list. Clears the current context and variables, starting a new session from a blank state.

Resume Last Chat

A persistent button above the input box showing the title of the previous session. Click to restore the last conversation's context with one click.

Free Quota Usage

Shows the used percentage of the free quota of the current account, the tokens already consumed, the total quota, the remaining tokens, and the validity period. When the free quota is used up or has expired, the block shows Free quota depleted or Free quota expired, after which token consumption is billed as pay-as-you-go.

Conversation Token Usage

After you open a specific conversation, the lower-left corner of the panel shows the tokens that the conversation has consumed. Hover over the number to expand a usage detail panel.

Input Area Usage

The input box supports the following interaction methods:

  • Type natural language and press Enter to send. Use Shift+Enter for line breaks.

  • Type / to open the Skills panel, which displays currently available Skills in a flat list and supports keyword filtering. Currently available Skills include Instance Management (/im), Network Management (/nm), Instance Diagnosis (/id), Data Insights (/di), and Product Consultation (/pc). After selecting a Skill, a parameter confirmation form is displayed with some parameters auto-populated based on the current context.

  • Type @ to designate a target instance and use it as the context for the current question, so that you do not have to select the instance again on the context card. The placeholder text in the input box is Enter a question. Use / to invoke a skill or @ to specify an instance..

  • A permanent AI disclaimer is displayed at the bottom of the input box: Content is generated by AI and for reference only. You are solely responsible for any judgments and operations based on this content. Verify critical operations manually.

Complete Diagnosis Flow

Taking "Why were writes to my index unusually slow yesterday?" as an example, the complete flow is as follows:

  1. The user enters a natural language query. ES Agent identifies the intent and displays an intent confirmation card with pre-filled key parameters such as instance ID and time range.

  2. After the user confirms the parameters, the Skill enters the execution phase. A step-by-step Timeline displays progress in real time: collect metrics → correlate logs → analyze configurations → identify bottlenecks → form conclusions.

  3. After the Skill completes, a result card is displayed containing a root cause summary, key evidence, and actionable optimization recommendations. Expand the Tool Call fold details to see which tools and parameters were invoked by the model.

  4. The user can continue to ask follow-up questions based on the results, such as "How should the shards be adjusted?", entering deep diagnostic mode.

Data Insights

Data Insights gives ES Agent the capability to query and analyze index data in natural language (NL2ES). In an existing conversation, select a data source and describe your analysis requirements in natural language. The assistant generates a query based on the authorized ES connection and the index schema, runs the query, and returns the results in the conversation. Data Insights does not provide a separate workbench; it reuses the Agent conversation, historical sessions, and context follow-up capabilities.

Usage flow

  1. Type / in the input box and select the Data Insights Skill (/di), or directly ask a question about index business data and the assistant matches this Skill by intent. You can also click the card with the same name in the quick operations area on the home page.

  2. On the context card displayed in the conversation, select the Region and the Instance ID, select a Credential, and then click Confirm. For how to create and select a credential, see Connect to ES instances with user credentials.

  3. Describe your analysis requirements in natural language in the conversation. The assistant locates the target indexes within the authorization scope of the selected credential and generates a query. If a required time condition is missing or a metric definition is unclear, the assistant asks follow-up questions in the conversation instead of automatically expanding the query scope.

  4. After execution completes, the assistant returns a metric summary, an analysis description, and result data (charts or data tables) in the same message flow, and retains the instance, indexes, and filter conditions of this query so that you can ask follow-up questions based on the results.

Note

The read capability of Data Insights is limited to _search, _count, _field_caps, and the Mapping reads that are necessary. By default, it does not run _bulk, _delete_by_query, script updates, index creation or deletion, or cluster management APIs. Writes support single-document updates only. See Controlled writes.

Connect to ES instances with user credentials

Data Insights uses a user credential to establish a data access session of the current user to the target instance. The credential password is encrypted and stored on the Alibaba Cloud server side, and never enters chat records, model inputs, or logs. Credentials are created and managed on the Security page of the instance. Creation steps:

  1. In the Elasticsearch console, go to the Security page of the target instance, and click Create Credential in the User Credential Management area.

  2. Enter the credential name, account, and password. The account must have read (or write) permissions on the target indexes. The password must be 8 to 30 characters long and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Each instance has only one default credential, which is used automatically when no credential is specified in a call.

  3. On the context card in the assistant conversation, click Select Credential to select the credential. You can also click Create Credential to go to the security configuration page of the instance, create a credential, and return to select it. After the connection succeeds, the assistant reads the indexes and schema within the authorization scope of the current account.

Note

On the context card, you can also select Skip for Now. In this case, the assistant does not establish an ES data access session and can only answer product consultation and cluster diagnosis questions, but cannot query index business data. After you switch to another credential, the assistant re-reads the authorized indexes and schema and does not reuse the permissions of the previous credential.

Controlled writes

When you explicitly request a data modification in the conversation, the assistant generates a write request and runs it in the session, and returns the update result after execution completes.

Note

Writes support single-document updates only. Batch updates, deletions, truncate operations, script updates, index creation or deletion, and cluster management write operations are not in the open scope. If the document ID, target field, or target value is missing, the assistant asks follow-up questions to complete the information first and does not automatically expand a vague description into a batch update.

Typical Scenarios

ES Agent covers the full lifecycle of ES operations. This section describes typical usage by scenario.

Alert Response

After you receive an alert, you can jump from the console to ES Agent with one click, and the alert context is populated automatically. ES Agent correlates the five dimensions of data, namely monitoring metrics, cluster logs, configuration items, request traces, and alerts and operations events, to complete the analysis automatically, and gives fix suggestions such as parameter tuning, scaling, or throttling directly in the result card. Critical operations can be run inside the assistant and require a secondary confirmation before execution.

This scenario depends on the operations event statistics permission elasticsearch:ListStatsEventRecords, which is already included in AliyunElasticsearchReadOnlyAccess and is also used to show the unread badge in the event center. For more information, see the Permissions section in ES Agent.

Regular Inspection

ES Agent provides automated inspection capabilities:

  • You can create scheduled tasks to run automatic batch inspections on a one-off, daily, weekly, or monthly cycle, covering dimensions such as cluster health, node load, index scale, shard balance, slow queries, JVM, and disk. Inspection items can be selected as needed. For more information, see Configure scheduled tasks.

  • High-risk items are proactively pushed to the console and can also be pushed to DingTalk, Feishu, or WeCom group chats. For more information, see Configure IM notification channels.

  • Inspection reports support subscriptions and export, facilitating team weekly reports and leadership reviews.

Performance Optimization

ES Agent provides performance insights and optimization recommendations:

  • Automatic slow query categorization with before-and-after DSL comparisons.

  • Automatic identification of typical issues such as uneven sharding, hotspot nodes, and inappropriate field types.

  • Actionable optimization recommendations, such as specific reindex, template, and setting modification statements.

  • Support for follow-up deep diagnostic queries, progressively narrowing the troubleshooting scope.

Capacity Planning

ES Agent provides capacity prediction and configuration recommendations:

  • Predict future storage and write pressure based on historical trends.

  • Evaluate cold-hot tiered storage strategies and provide ILM configuration recommendations.

  • Recommend differentiated solutions such as OpenStore, DFS, and Indexing Service for cost-sensitive scenarios.

  • Upgrade and downgrade recommendations with specific specifications and pricing estimates.

Configure scheduled tasks

In addition to triggering inspections in conversations, ES Agent supports scheduled tasks. Tasks are divided into two types: Inspection Task (Check instance health, performance, and capacity risks by execution cycle.) and Alert Task (Listens to Event Center events and notifies IM channels in real time.). After a task is created, it is displayed under the corresponding tab on the Tasks page. Inspection results or alert notifications can be pushed to IM channels, which is suitable for daily on-duty and periodic health checks.

Create an inspection task

  1. Log on to the Alibaba Cloud Elasticsearch console and click AI Assistant in the left-side navigation pane.

  2. Click Tasks at the top of the page. The top of the page shows four statistics: Total Tasks, Running, Executed Today, and Risks Found This Month. Below them, the task list is displayed under three tabs: All, Inspection Task, and Alert Task. You can filter tasks by status.

    The system presets a System Default Inspection Task, which runs once a day on all instances by default. You can view its inspection results directly, or edit or pause it.

    Click Create Scheduled Task.

  3. Configure the following parameters and submit the task.

    Parameter

    Description

    Task Name

    The name of the task, 1 to 50 characters in length, used to distinguish different tasks in the task list.

    Task Type

    Select Inspection Task or Alert Task. The parameters in the following table are for inspection tasks. For the parameters of alert tasks, see Create an alert task.

    Inspection Targets

    The instances to be inspected by this task. You can select multiple instances for a batch inspection at a time, or select All Instances.

    Schedule

    The trigger frequency of the task. You can select Once, Daily, Weekly, or Monthly. The default is Daily. The execution time is set in the UTC+8 time zone.

    Basic Inspection Items

    The check items that cover basic cluster health checks. No token fees are incurred. You can select items as needed or select all at once. Available items include: cluster color status diagnosis, cluster node disconnection diagnosis, cluster storage resource diagnosis, cluster compute resource diagnosis, master node overload diagnosis, index replica rationality diagnosis, node load deviation diagnosis, excessive node shard count diagnosis, index shard rationality diagnosis, query queue backlog diagnosis, query latency diagnosis, and node disk load deviation diagnosis.

    Advanced Inspection Items

    The in-depth analysis items selected as needed. Billed based on token usage. Available items include: in-depth write performance inspection diagnosis, in-depth query performance inspection diagnosis, in-depth CPU load inspection diagnosis, in-depth disk load inspection diagnosis, in-depth memory and GC inspection diagnosis, and in-depth risky configuration inspection diagnosis.

    At least one item must be selected in total from basic inspection items and advanced inspection items. Otherwise, the task cannot be submitted.

    Enable IM channel

    After you turn on this switch, inspection results are pushed to the associated IM channels. After you turn it on, select the channel type and the IM channel in sequence, and enter the Webhook URL of the corresponding group robot in the webhook input box. For how to obtain the Webhook URL, see Configure IM notification channels. You can configure up to 5 notification channels for a single task.

After creation, the task is displayed in the Tasks list, where you can view the task name, status, instance scope, execution cycle, last execution time, and execution result. You can also perform the following operations on a single task:

  • Run Now: Run an inspection immediately without waiting for the next trigger.

  • Edit: Modify the inspection objects, execution cycle, or inspection items of the task.

  • Pause: After pausing, the task is no longer triggered by the cycle and can be resumed at any time.

Note

Basic inspection items do not incur token fees, while advanced inspection items are billed based on token usage. If advanced inspection items are selected in a task, evaluate the usage based on the number of inspection objects and the execution cycle to avoid rapid consumption of the free quota.

Create an alert task

An alert task monitors events in the event center and pushes notifications to the associated IM channels in real time when an event is triggered, without waiting for the inspection cycle. It is suitable for immediate response to events such as changes and cluster health issues.

  1. On the Tasks page, click Create Task and select Alert Task for Task Type.

  2. Configure the following parameters and submit the task.

    Parameter

    Description

    Task Name

    The name of the task, 1 to 50 characters in length.

    Monitored Object

    The instance scope of monitored events. You can select All Instances or specified instances.

    Event Rule

    Filters the events that trigger notifications. It contains three items: Event Type (system changes, cluster health, cluster changes, and product updates available), Event Name (All Event Names or specific events available), and Severity (Critical, Warning, Info).

    Trigger Mode

    Alert Deduplication can be set to 5, 15, 30, or 60 minutes. Duplicate alerts within the window are notified only once. After you enable Send a recovery notification when the event recovers, a recovery notification is sent synchronously when the event recovers.

    Notification Destination

    Turn on the IM channel and associate configured IM channels. A single task can be associated with up to 5 channels. Complete the channel configuration before use. See Configure IM notification channels. You can click Test Notification to verify channel connectivity.

After creation, the task starts monitoring events in the event center. On the Alert Task tab, you can view the trigger time, event description, type and severity, and notification status (sent successfully, partially successful, failed to send, skipped) of the task, and pause, enable, edit, or delete the task.

Configure IM notification channels

After you configure IM channels, exceptions found by inspections can be pushed to O&M group chats for timely response. Currently, DingTalk, Lark, and WeCom channels are supported. Each channel can be independently associated with scheduled tasks.

Before configuration, create an application on the corresponding IM open platform and obtain the credentials. For DingTalk, log on to the DingTalk Open Platform and obtain the Client ID and Client Secret on the Credentials and Basic Information page of the target application.

If you push through a DingTalk group robot Webhook, obtain the Webhook URL in the DingTalk client first. Steps:

  1. Open the DingTalk client and go to the target group chat for pushing. If no group exists yet, start a group chat and add members first.

  2. Click the group settings in the upper-right corner of the group chat, select Robot, and then click Add Robot.

  3. In the robot list, select Custom (connect a custom service via Webhook) and add it to the group chat.

  4. After the robot is added, copy the Webhook URL in the Set webhook step (in the format https://oapi.dingtalk.com/robot/send?access_token=...). Keep the Webhook URL confidential and do not publish it on external websites. A leaked Webhook URL poses security risks.

  5. In the Notification Destination row of the scheduled task or alert task form, turn on Enable IM Channel, select the channel type (such as DingTalk) and the IM channel in sequence, and paste the copied Webhook URL into the webhook input box in this row. You can configure up to 5 notification channels for a single task.

  1. Click IM Channels at the top of the ES Agent page, and then click Add Channel.

  2. Configure the following parameters and submit.

    Parameter

    Description

    Channel Name

    The name of the channel, used to distinguish different channels in the channel list and task configuration.

    Channel Type

    Select DingTalk, Lark, or WeCom.

    Credential Configuration

    Select an existing credential, or create a credential and enter the Client ID and Client Secret obtained from the IM open platform.

    Role Configuration

    Select the RAM role used by this IM channel. If no role is created yet, click Go to Create Role in the configuration panel to create one in the RAM console and return to select it. The panel also provides the IM Channel Role Configuration description link. You can refer to the permission requirements in it to configure the role.

    Enable This Channel

    If turned on, the channel is enabled immediately after creation. If turned off, the configuration is saved first and you can enable it manually in the channel list later.

  3. After creation, the channel is displayed under the tab of the corresponding type (the tab name shows the number of configured channels of that type). In the list, you can view the channel name, channel type, and creation time, and perform Edit or Delete on a single channel.

    In a scheduled task, turn on Enable IM Channel and associate this channel to receive inspection result pushes.