# opensearch-knowledge

Part of **OPENSEARCH**

# OpenSearch Knowledge Base Management Console Guide

## Operations Overview

| Operation | Console Entry | Prerequisites | Description |
|----------|---------------|---------------|-------------|
| Create a Knowledge Base | Console > OpenSearch-LLM-based Agentic Search > Knowledge Base > Create Knowledge Base | Access to the OpenSearch-LLM-based Agentic Search console, Region set to China (Shanghai), Target workspace selected, Elasticsearch or OpenSearch instance with public access enabled, IP address 47.100.254.67 added to the public allowlist of the source instance | Configure a knowledge base by connecting to Elasticsearch or OpenSearch and setting up vectorization models for intelligent Q&A. |
| Build a Knowledge Base Q&A System with RAG | Console > AI Search Open Platform > RAG > Scenario Center > Create RAG Pipeline | AI Search Open Platform activated, Service endpoint and authentication credentials obtained, Alibaba Cloud Elasticsearch cluster (ES 8.9+) created, IP address added to cluster's whitelist | Create an end-to-end Retrieval-Augmented Generation (RAG) pipeline using modular algorithm services via the Scenario Center UI. |

## Step-by-Step Instructions

### Create a Knowledge Base

**Navigation**: Console > OpenSearch-LLM-based Agentic Search > Knowledge Base > Create Knowledge Base

**Prerequisites**:
- Access to the OpenSearch-LLM-based Agentic Search console
- Region set to China (Shanghai)
- Target workspace selected
- Elasticsearch or OpenSearch instance with public access enabled
- IP address 47.100.254.67 added to the public allowlist of the source instance

1. Log on to the **OpenSearch-LLM-based Agentic Search console**
   - Element: **OpenSearch-LLM-based Agentic Search console** (link) — top navigation bar

2. Select the **China (Shanghai)** region
   - Element: **China (Shanghai)** (dropdown) — top-right corner

3. Switch to **OpenSearch-LLM-based Agentic Search** mode if not already active
   - Element: **OpenSearch-LLM-based Agentic Search** (menu) — left-side navigation pane

4. Select the target **workspace**
   - Element: **workspace** (dropdown) — left-side navigation pane

5. Click **Knowledge Base** in the left navigation panel
   - Element: **Knowledge Base** (menu) — left-side navigation panel

6. Click **Create Knowledge Base**
   - Element: **Create Knowledge Base** (button) — main content area

7. Enter a unique **Name** for the knowledge base
   - Element: **Name** (text_input) — form fields
   - Notes: Must be unique within the workspace

8. Select the **Source Type**
   - Element: **Source Type** (dropdown) — form fields
   - Options: Alibaba Cloud Elasticsearch, OpenSearch Vector Search Edition, OpenSearch Conversational Search Edition

9. Enter the **Domain** address
   - Element: **Domain** (text_input) — form fields
   - Notes: For Elasticsearch, use the public address from the Elasticsearch console (e.g., http://es-xx-xxxxxxxxxxxxxxxxx.public.elasticsearch.aliyuncs.com:9200); for OpenSearch Vector, get it from instance details

10. Enter **Authentication Credentials** in `username:password` format
    - Element: **Authentication Credentials** (text_input) — form fields
    - Notes: For Elasticsearch, username is always 'elastic'; password can be reset in the Elasticsearch console

11. Enter the **Index Name**
    - Element: **Index Name** (text_input) — form fields

12. Select **Query Type**
    - Element: **Query Type** (radio) — form fields
    - Notes: Choose **Hybrid Search** (combines text and vector search) or **Text Search** (supports query_string, search_template, or DSL)

13. Select the **Dense Vectorization Model**
    - Element: **Dense Vectorization Model** (dropdown) — form fields
    - Notes: Refer to Model overview documentation for available models

14. Select the **Sparse Vectorization Model**
    - Element: **Sparse Vectorization Model** (dropdown) — form fields

15. Set the **Model Service Endpoint**
    - Element: **Model Service Endpoint** (text_input) — form fields
    - Notes: Use the endpoint in the current workspace

16. Enter the **API Key** for model authentication
    - Element: **API Key** (text_input) — form fields
    - Notes: Used to authenticate when calling the model service

17. Test the configuration
    - Element: **Validate Configuration** (button) — right panel
    - Notes: If successful, the system confirms that knowledge base data can be read

18. Save the configuration
    - Element: **Confirm** (button) — right panel

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Name | text_input | Yes | — | Unique name for the knowledge base within the workspace |
| Source Type | dropdown | Yes | Alibaba Cloud Elasticsearch, OpenSearch Vector Search Edition, OpenSearch Conversational Search Edition | The source system from which data will be ingested |
| Domain | text_input | Yes | — | Public address of the source instance (e.g., http://es-xx-xxxxxxxxxxxxxxxxx.public.elasticsearch.aliyuncs.com:9200) |
| Authentication Credentials | text_input | Yes | — | Username and password in format username:password |
| Index Name | text_input | Yes | — | Name of the index in the source system |
| Query Type | radio | Yes | Hybrid Search, Text Search | Method used to retrieve data from the knowledge base |
| Dense Vectorization Model | dropdown | Yes | — | Model used to generate dense vectors for semantic search |
| Sparse Vectorization Model | dropdown | Yes | — | Model used to generate sparse vectors for keyword-based search |
| Model Service Endpoint | text_input | Yes | — | Endpoint of the model service in the current workspace |
| API Key | text_input | Yes | — | API key used to authenticate calls to the model service |

### Build a Knowledge Base Q&A System with RAG

**Navigation**: Console > AI Search Open Platform > RAG > Scenario Center > Create RAG Pipeline

**Prerequisites**:
- AI Search Open Platform is activated
- Service endpoint and authentication credentials are obtained
- Alibaba Cloud Elasticsearch cluster running ES 8.9 or later is created
- IP address of the device is added to the cluster's IP address whitelist

1. Log on to the **AI Search Open Platform console**
   - Element: **AI Search Open Platform console** (link) — top navigation bar

2. Select the **China (Shanghai)** region
   - Element: **China (Shanghai)** (dropdown) — top-right corner

3. Navigate to the **RAG** workspace
   - Element: **RAG** (menu) — left-side navigation pane

4. Click the **RAG scenario center card**
   - Element: **RAG scenario center card** (panel) — main content area

5. Click the entry button to start pipeline creation
   - Element: **entry button** (button) — on the RAG scenario center card

6. Select required algorithm services from **drop-down lists**
   - Element: **drop-down lists** (dropdown) — service selection section
   - Notes: The service ID (e.g., ops-document-analyze-001) is automatically updated in the generated code

7. Proceed to code generation
   - Element: **Next** (button) — bottom of the page

8. Copy or download the generated code
   - Element: **Copy** (button) — code section
   - Notes: Switch between **offline** and **online** tabs to access different code templates

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| api_key | text_input | Yes | — | The API key for authentication |
| aisearch_endpoint | text_input | Yes | — | The API endpoint. Remove the http:// prefix |
| workspace_name | text_input | Yes | default | The name of your workspace in AI Search Open Platform |
| service_id | text_input | No | — | The service ID for each algorithm service |
| es_host | text_input | Yes | — | The endpoint of your Alibaba Cloud Elasticsearch cluster |
| es_auth | text_input | Yes | — | The username and password for accessing the Elasticsearch cluster (username: elastic) |

## FAQ

Q: Where do I find the public domain address for my Elasticsearch instance?
A: In the Alibaba Cloud Elasticsearch console, go to your instance details and copy the public network address under "Network Information".

Q: What happens if I leave the API Key field empty?
A: The system will fail to authenticate when calling the vectorization model, and the knowledge base creation will not succeed.

Q: Can I change the Query Type after creating the knowledge base?
A: No, the Query Type (Hybrid Search or Text Search) must be selected during creation and cannot be modified afterward.

Q: Do I need to add any specific IP addresses to my allowlist?
A: Yes, you must add the IP address 47.100.254.67 to the public allowlist of your Elasticsearch or OpenSearch instance to allow the OpenSearch Agentic Search service to access it.

Q: What permissions are required to create a knowledge base?
A: You need console access to OpenSearch-LLM-based Agentic Search, permission to select workspaces, and valid credentials for the source data store (Elasticsearch/OpenSearch).

## Pricing & Billing

### Billing Model
Billing is based on per-request usage (per 1,000 tokens).

### Price Reference

| Tier | Input Price | Output Price |
|------|-------------|--------------|
| default | 0.002 /tokens | 0.004 /tokens |
| ops-document-analyze-001 | 0.002 /tokens | 0.002 /tokens |
| ops-text-embedding-001 | 0.002 /tokens | 0.002 /tokens |
| ops-qwen-turbo | 0.002 /tokens | 0.002 /tokens |

### Free Tier
Monthly free quota of 1 million tokens.

### Billing Notes
- Asynchronous tasks are billed upon completion.
- Minimum charge duration is 1 hour for async tasks.
- Maximum token limit per request is 8K tokens.