# opensearch-text_and_query_analysis

Part of **OPENSEARCH**

# OpenSearch Text and Query Analysis Console Guide

## Operations Overview

| Operation | Console Entry | Prerequisites | Description |
|------|-----------|---------|------|
| Configure Custom Dictionary | Instance Details > Configuration Center > Advanced Configurations | An Open Search instance with at least one index table; Identification of the dictionary used by the index table containing the target field | Add custom intervention entries to override built-in tokenization for domain-specific terms |
| Configure Industry Analyzer | Console > OpenSearch > Index Management > Create Index > Advanced Settings > Analyzer Configuration | An OpenSearch instance with Retrieval Engine Edition enabled; Access to index management console; Understanding of field types | Select a pre-built Chinese analyzer for e-commerce, esports, education, or IT content |
| Customize Tokenization | Configuration Center > Advanced Configuration | An Elasticsearch instance with advanced configuration enabled; Access to Configuration Center and Operation Center; Dictionary file ready (if uploading) | Modify tokenization behavior via direct input or file upload in the _offline_adv_edit version |
| Manage Dictionaries | Console > OpenSearch > Query Analysis > Dictionary Management | OpenSearch instance created; Access to OpenSearch console | View built-in dictionaries and create custom intervention dictionaries |
| Adjust Category Prediction Relevance | Console > Search Algorithm Center > Retrieval Configuration | Access to OpenSearch console; A configured category prediction model; Permission to manage dictionaries | Create intervention entries to adjust relevance scores for specific query-category pairs |
| Correct NER Results | Console > Search Algorithm Center > Retrieval Configuration | An OpenSearch application with NER capabilities; E-commerce Analyzer already set up | Fix named entity recognition errors using full or partial match intervention rules |
| Create Spelling Correction Dictionary | Console > Search Algorithm Center > Retrieval Configuration > Dictionary Management | Access to OpenSearch console; Existing query analysis rule setup; Permissions to manage dictionaries | Define misspelled-to-corrected word mappings for query rewriting |
| Customize Stop Word Filtering | Console > Search Algorithm Center > Retrieval Configuration > Dictionary Management | Access to OpenSearch console; A query analysis rule with stop word filtering enabled | Add or block custom stop words to control query segmentation |
| Create Synonym Intervention Dictionary | Console > Search Algorithm Center > Retrieval Configuration > Dictionary Management | Access to OpenSearch console; A configured application with query analysis rules | Expand search queries by mapping terms to user-defined synonyms |
| Create Intervention Dictionary for Term Weight Analysis | Console > Search Algorithm Center > Retrieval Configuration > Dictionary Management | An OpenSearch application created; Console access; Application version ID available | Assign high/medium/low weights to segmented terms to influence relevance scoring |
| Configure NER Rule in Console | Console > Search Algorithm Center > Retrieval Configuration > Query Analysis Rule Management | Access to OpenSearch console; Existing application with online/offline version; Permissions to manage rules | Enable Named Entity Recognition in a query analysis rule for e-commerce queries |
| Enable Spelling Correction | Console > Search Algorithm Center > Retrieval Configuration | Access to OpenSearch console; Existing application with online/offline version | Activate spelling correction in a query analysis rule using built-in or custom dictionaries |
| Manage Analyzer | Console > Search Algorithm Center > Retrieval Configuration > Analyzer Management | Log on to the OpenSearch console | View built-in and custom analyzers available for text segmentation |
| Configure Query Analysis (NL2SQL) | AI Search Open Platform > Instance Info > RAG Model Service Configuration > Create New Service | Access to AI Search Open Platform console; Understanding of database schema | Set up natural language to SQL conversion with table config, training samples, and glossary |
| Configure Fuzzy Query Analysis | Console > Elasticsearch > Instance Management > Details > Modify Offline Application | An offline application in Normal state; Field mappings between schema and data source | Enable fuzzy matching and synonym expansion for improved recall |

## Step-by-Step Instructions

### Configure Custom Dictionary

**Navigation**: Instance Details > Configuration Center > Advanced Configurations

**Prerequisites**:
- An Open Search instance with at least one index table
- Identification of the dictionary used by the index table containing the target field

1. Navigate to the Configuration Center from the Instance Details page  
   - Element: **Configuration Center** (link) — left-side navigation pane

2. Select Advanced Configurations  
   - Element: **Advanced Configurations** (link) — left-side navigation pane

3. Find the version named _offline_adv_edit and click Modify  
   - Element: **Modify** (button) — Actions column

4. Locate the dictionary used by the target index table and click Modify  
   - Element: **Modify** (button) — Actions column

5. Add a custom intervention entry via direct input or file upload  
   - Element: **Submit** (button) — panel  
   - Notes: File must be .dict or .txt format and not exceed 5 MB

6. Publish the edited version with a version description  
   - Element: **Publish** (button) — Actions column  
   - Notes: System generates a new read-only version like _offline_adv_v2

7. Synchronize the change and trigger reindexing  
   - Element: **Update Configurations** (button) — O&M Management page  
   - Notes: Required for changes to take effect on existing documents

8. Monitor reindexing progress on the Data Source Changes tab  
   - Element: **Data Source Changes** (tab) — Change History page in O&M Center

### Configure Industry Analyzer

**Navigation**: Console > OpenSearch > Index Management > Create Index > Advanced Settings > Analyzer Configuration

**Prerequisites**:
- An OpenSearch instance with Retrieval Engine Edition enabled
- Access to the index management console
- Understanding of field types in OpenSearch schema

1. Navigate to the index creation page  
   - Element: **Create Index** (button) — main content area

2. Select the advanced settings tab  
   - Element: **Advanced Settings** (tab) — top navigation panel

3. Locate the analyzer configuration section  
   - Element: **Analyzer Configuration** (section) — left navigation panel

4. Choose an analyzer from the dropdown menu  
   - Element: **Analyzer** (dropdown) — main content area  
   - Notes: Available options: chn_ecommerce_general, chn_esports_general, chn_edu_question, chn_it_content

5. Save the configuration  
   - Element: **Save** (button) — bottom-right corner  
   - Notes: Changes take effect after publishing

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Analyzer | dropdown | Yes | chn_ecommerce_general, chn_esports_general, chn_edu_question, chn_it_content | Select the pre-built analyzer for domain-specific Chinese text processing |

### Customize Tokenization

**Navigation**: Configuration Center > Advanced Configuration

**Prerequisites**:
- An Elasticsearch instance with advanced configuration enabled
- Access to the Configuration Center and Operation Center
- A dictionary file ready for upload (if using file upload method)

1. Find the advanced configuration version with the suffix '_offline_adv_edit' and click Edit in the Actions column  
   - Element: **Edit** (button) — Actions column on the Advanced Configuration page

2. In the corresponding index table, find the tokenizer type that is referenced by the index and click Edit  
   - Element: **Edit** (button) — Corresponding index table

3. Enter 'ping-pong racket' in the text box and click OK  
   - Element: **OK** (button) — Text input dialog

4. Upload a new dictionary file and edit its content in the text box, then click OK  
   - Element: **Upload** (button) — File upload section  
   - Notes: The file must be smaller than 5 MB and in .dict or .txt format.

5. Publish the updated dictionary configuration  
   - Element: **Publish** (button) — Top of the configuration editor  
   - Notes: Enter a remark for the new version.

6. Push the offline configuration and trigger an index rebuild  
   - Element: **Push Offline Configuration** (button) — Operation Center > Change History  
   - Notes: After the index is rebuilt, changes are reflected in online queries.

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Remark | text_input | No | — | A description to distinguish the purpose of each version. |

### Manage Dictionaries

**Navigation**: Console > OpenSearch > Query Analysis > Dictionary Management

**Prerequisites**:
- OpenSearch instance created
- Access to the OpenSearch console

1. Navigate to the Dictionary Management page  
   - Element: **Dictionary Management** (link) — left navigation panel

2. View the list of built-in dictionaries  
   - Element: **Built-in Dictionaries** (tab) — main content area  
   - Notes: Built-in dictionaries cannot be configured or deleted.

3. Create a custom intervention dictionary  
   - Element: **Create Custom Dictionary** (button) — top-right corner  
   - Notes: Custom dictionaries are used in combination with built-in dictionaries. Conflicts are resolved in favor of the custom dictionary entry.

### Adjust Category Prediction Relevance

**Navigation**: Console > Search Algorithm Center > Retrieval Configuration

**Prerequisites**:
- Access to the OpenSearch console
- A configured category prediction model
- Permission to manage dictionaries and configure retrieval settings

1. Log on to the OpenSearch console and navigate to Search Algorithm Center > Retrieval Configuration  
   - Element: **Search Algorithm Center** (menu) — left-side navigation pane

2. Click Dictionary Management in the left-side pane  
   - Element: **Dictionary Management** (link) — left-side pane

3. Click Create in the upper-right corner to start creating a new intervention dictionary  
   - Element: **Create** (button) — upper-right corner

4. Specify a name for the dictionary and set the Dictionary Type to Category Prediction  
   - Element: **Category Prediction** (dropdown) — Create Query Analysis Dictionary panel

5. After creation, find the dictionary in the list and click Manage Entries in the Actions column  
   - Element: **Manage Entries** (link) — Actions column

6. Click Add Intervention Entry to create a new entry  
   - Element: **Add Intervention Entry** (button) — Manage Entries page

7. Enter the search query and category ID-relevance pairs in the specified format  
   - Element: **Query** (text_input) — Query column  
   - Notes: Format: category ID-relevance value; multiple pairs separated by semicolons

8. Apply the intervention dictionary to an online category prediction model  
   - Element: **Apply** (button) — model configuration page  
   - Notes: Must be applied to an online application to take effect

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Name | text_input | Yes | — | The unique name for the intervention dictionary |
| Dictionary Type | dropdown | Yes | Category Prediction | Selects the type of intervention dictionary being created |
| Query | text_input | Yes | — | The exact search query to which the intervention applies |
| Category ID-Relevance | text_input | Yes | — | One or more category ID-relevance pairs in format 'ID-value'; values are 0 (none), 1 (weak), 2 (strong) |

### Correct NER Results

**Navigation**: Console > Search Algorithm Center > Retrieval Configuration

**Prerequisites**:
- An OpenSearch application instance with NER capabilities configured
- Access to the OpenSearch console
- E-commerce Analyzer already set up

1. Create an NER intervention dictionary  
   - Element: **Create** (button) — upper-right corner of the Dictionary Management page

2. Specify dictionary details  
   - Element: **Dictionary Type** (dropdown) — main content area  
   - Notes: Set to 'Entity Recognition'. Only 'E-commerce Analyzer' is available as a selection when this type is chosen.

3. Add intervention entries  
   - Element: **Manage Entries** (link) — Actions column on the Dictionary Management page

4. Add a new intervention entry  
   - Element: **Add Intervention Entry** (button) — Manage Entries page

5. Test and publish the rule  
   - Element: **Associate with unpublished query analysis rule** (link) — Query Analysis Rule Management page  
   - Notes: Perform a search test before publishing to ensure expected performance.

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Dictionary Type | dropdown | Yes | Entity Recognition | Selects the type of dictionary; only 'Entity Recognition' is valid for NER intervention. |
| Associated Analyzer | dropdown | Yes | E-commerce Analyzer | Must match the analyzer used in indexes for the intervention to work. |
| Intervention Type | dropdown | No | Full Match, Partial Match | Determines whether the intervention applies to exact or partial matches of the search query. |
| Ignore Spaces | checkbox | No | — | When enabled, spaces in search queries are ignored during NER intervention. |

### Create Spelling Correction Dictionary

**Navigation**: Console > Search Algorithm Center > Retrieval Configuration > Dictionary Management

**Prerequisites**:
- Access to OpenSearch console
- Existing query analysis rule setup
- Permissions to create and manage dictionaries

1. Log on to the OpenSearch console and navigate to Dictionary Management.  
   - Element: **Dictionary Management** (link) — left-side pane

2. Click Create in the upper-right corner to start creating a new intervention dictionary.  
   - Element: **Create** (button) — upper-right corner

3. Specify a name for the dictionary and set the Dictionary Type to Spelling Correction.  
   - Element: **Dictionary Type** (dropdown) — Create Query Analysis Dictionary panel  
   - Notes: Ensure the type is set to 'Spelling Correction' for this use case.

4. Find the created dictionary in the list and click Manage Entries in the Actions column.  
   - Element: **Manage Entries** (link) — Actions column

5. Click Add Intervention Entry to create a new correction rule.  
   - Element: **Add Intervention Entry** (button) — top of the page

6. Enter the incorrect search query in the Search Query field and the corrected word in the Corrected Word field.  
   - Element: **Search Query** (text_input) — Add Intervention Entry panel  
   - Notes: Example: 'hujian' → 'fujian'

7. Set the Intervention Type to Add and click Save.  
   - Element: **Save** (button) — bottom of the form

8. Go to Query Analysis Rule Management and associate the dictionary with a rule.  
   - Element: **Create** (button) — upper-right corner  
   - Notes: Select the newly created dictionary from the available options.

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Dictionary Name | text_input | Yes | — | A unique name for the intervention dictionary. |
| Dictionary Type | dropdown | Yes | Spelling Correction | Specifies the purpose of the dictionary. Must be 'Spelling Correction' for this feature. |
| Search Query | text_input | Yes | — | The incorrect or misspelled search term that needs correction. |
| Corrected Word | text_input | Yes | — | The intended correct version of the search query. |
| Intervention Type | radio | Yes | Add, Block | Determines whether the correction should be applied (Add) or prevented (Block). |

### Customize Stop Word Filtering

**Navigation**: Console > Search Algorithm Center > Retrieval Configuration > Dictionary Management

**Prerequisites**:
- Access to the OpenSearch console
- A query analysis rule with stop word filtering enabled

1. Log on to the OpenSearch console and navigate to the Dictionary Management page.  
   - Element: **Search Algorithm Center** (menu) — left-side navigation pane

2. Click Create in the upper-right corner to start creating a new intervention dictionary.  
   - Element: **Create** (button) — upper-right corner of the Dictionary Management page

3. Specify a name for the dictionary and set the Dictionary Type to Stop Word.  
   - Element: **Dictionary Type** (dropdown) — Create Query Analysis Dictionary panel

4. Find the created dictionary in the list and click Manage Entries in the Actions column.  
   - Element: **Manage Entries** (link) — Actions column

5. Click Add Intervention Entry to add a new entry.  
   - Element: **Add Intervention Entry** (button) — top of the entry management page

6. Enter a stop word in the Stop Word column and select Add as the Intervention Type.  
   - Element: **Stop Word** (text_input) — Add Intervention Entry panel

7. Click Save to save the intervention entry.  
   - Element: **Save** (button) — bottom of the Add Intervention Entry panel

8. Go to the Query Analysis Rule Management page and associate the intervention dictionary with a rule.  
   - Element: **Create** (button) — upper-right corner of the Query Analysis Rule Management page

9. Perform a search test to verify the effect of the intervention dictionary.  
   - Notes: Test the rule with sample queries like 'Hainan has bananas' to ensure documents containing 'Hainan bananas' are retrieved.

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Name | text_input | Yes | — | The name of the intervention dictionary. |
| Dictionary Type | dropdown | Yes | Stop Word | The type of dictionary to create. Select 'Stop Word' to define custom stop words. |
| Stop Word | text_input | Yes | — | The word to be added or blocked as a stop word in search queries. |
| Intervention Type | dropdown | Yes | Add, Block | Specifies whether to add the word as a stop word (ignored in retrieval) or block it (included in retrieval). |

### Create Synonym Intervention Dictionary

**Navigation**: Console > Search Algorithm Center > Retrieval Configuration > Dictionary Management

**Prerequisites**:
- Access to the OpenSearch console
- A configured application with query analysis rules

1. Log on to the OpenSearch console and navigate to the Dictionary Management page  
   - Element: **Search Algorithm Center &gt; Retrieval Configuration** (menu) — left-side navigation pane

2. Click Create in the upper-right corner to start creating a new intervention dictionary  
   - Element: **Create** (button) — upper-right corner of the Dictionary Management page

3. Specify a name and set the dictionary type to Synonym in the Create Query Analysis Dictionary panel  
   - Element: **Dictionary Type** (dropdown) — Create Query Analysis Dictionary panel

4. Find the created intervention dictionary and click Manage Entries in the Actions column  
   - Element: **Manage Entries** (link) — Actions column on the Dictionary Management page

5. Click Add Intervention Entry to add a new entry  
   - Element: **Add Intervention Entry** (button) — page that appears after clicking Manage Entries

6. Enter the search query and synonym(s) in the respective fields and click Save  
   - Element: **Save** (button) — Add Intervention Entry panel  
   - Notes: Multiple synonyms can be separated by semicolons (;)

7. Go to the Query Analysis Rule Management page and associate the intervention dictionary with a rule  
   - Element: **Create** (button) — upper-right corner of the Query Analysis Rule Management page  
   - Notes: The dictionary must be associated before publishing the rule

8. Perform a search test to verify the expected behavior  
   - Notes: OpenSearch should return documents matching both the original query and the synonym

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Name | text_input | Yes | — | The name of the intervention dictionary |
| Dictionary Type | dropdown | Yes | Synonym | The type of dictionary to create; only 'Synonym' is supported for this feature |
| Search Query | text_input | Yes | — | The term or phrase to be replaced by synonyms |
| Add Synonym | text_input | Yes | — | The synonym(s) to be used in place of the search query; multiple synonyms can be separated by semicolons |

### Create Intervention Dictionary for Term Weight Analysis

**Navigation**: Console > Search Algorithm Center > Retrieval Configuration > Dictionary Management

**Prerequisites**:
- An OpenSearch application must be created
- Access to the OpenSearch console with appropriate permissions
- Application version ID available

1. Log on to the OpenSearch console and navigate to the Retrieval Configuration page.  
   - Element: **Search Algorithm Center** (menu) — left-side navigation pane

2. Click Dictionary Management in the left-side pane.  
   - Element: **Dictionary Management** (link) — left-side pane

3. Click Create in the upper-right corner to start creating a new dictionary.  
   - Element: **Create** (button) — upper-right corner

4. Specify a name for the intervention dictionary and select 'Term Weight' as the dictionary type.  
   - Element: **Dictionary Type** (dropdown) — Create Query Analysis Dictionary panel

5. Find the created dictionary in the list and click Manage Entries in the Actions column.  
   - Element: **Manage Entries** (link) — Actions column

6. Click Add Intervention Entry to define a new intervention rule.  
   - Element: **Add Intervention Entry** (button) — top of the entries page

7. Enter a search query, select an analyzer, and assign weights to each term.  
   - Element: **Add Intervention Entry panel** (text_input) — center of the page  
   - Notes: Supported analyzers: general, e-commerce, IT content, or custom based on these

8. Go to the Query Analysis page and click Create to associate the dictionary with a rule.  
   - Element: **Create** (button) — upper-right corner

9. Set whether to ignore spaces in search queries during intervention.  
   - Element: **Ignore spaces** (checkbox) — in the Add Rule panel  
   - Notes: Default is not to ignore spaces

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Name | text_input | Yes | — | The name of the intervention dictionary. |
| Dictionary Type | dropdown | Yes | term_weighting | Selects the type of dictionary. For this document, only 'term_weighting' is supported. |
| Search Query | text_input | Yes | — | The actual search query to be intervened upon. |
| Analyzer | dropdown | Yes | general, e-commerce, IT content, custom | Specifies how the search query is segmented into terms. |
| Weight | dropdown | Yes | high (7), medium (4), low (1) | Assigns a weight to each term in the segmented query. |
| Ignore spaces | checkbox | No | — | Determines whether spaces in the search query are ignored during matching. |

### Configure NER Rule in Console

**Navigation**: Console > Search Algorithm Center > Retrieval Configuration > Query Analysis Rule Management

**Prerequisites**:
- Access to the OpenSearch console
- An existing application with online/offline version
- Permissions to create and manage query analysis rules

1. Log on to the OpenSearch console and navigate to the Retrieval Configuration page  
   - Element: **Search Algorithm Center &gt; Retrieval Configuration** (menu) — left-side navigation pane

2. Click on Query Analysis Rule Management in the left-side pane  
   - Element: **Query Analysis Rule Management** (link) — left-side pane

3. Select an application name and version (online or offline), then click Create  
   - Element: **Create** (button) — top-right corner of the page

4. In the Add Rule panel, enter a rule name, select indexes, set Industry Type to E-commerce, select Entity Recognition, and click OK  
   - Element: **OK** (button) — bottom of the Add Rule panel  
   - Notes: In Configure Entity Type Importance, you can add or remove entity categories. By default, a built-in dictionary is used. If results are incorrect, specify an intervention dictionary.

5. Run a search test to verify the query analysis process  
   - Notes: View the process of query analysis after running the test.

6. Go to Index Orientation and set the created rule as the default query analysis rule  
   - Element: **Index Orientation** (tab) — top navigation bar

7. Check that the default query analysis rule is correctly applied  
   - Notes: 

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Rule Name | text_input | Yes | — | Enter a unique name for the query analysis rule. |
| Indexes | dropdown | Yes | — | Select one or more indexes to apply this rule to. |
| Industry Type | dropdown | Yes | E-commerce | Set the industry type to E-commerce to enable NER for e-commerce text. |
| Feature | checkbox | Yes | Entity Recognition | Enable the Named Entity Recognition feature for this rule. |

### Enable Spelling Correction

**Navigation**: Console > Search Algorithm Center > Retrieval Configuration

**Prerequisites**:
- Access to the OpenSearch console
- An existing application with online/offline version

1. Log on to the OpenSearch console and navigate to the Search Algorithm Center > Retrieval Configuration page  
   - Element: **Search Algorithm Center &gt; Retrieval Configuration** (link) — left-side navigation pane

2. Click on Query Analysis Rule Management in the left-side pane  
   - Element: **Query Analysis Rule Management** (link) — left-side pane

3. Select an application name and the online or offline version, then click Create  
   - Element: **Create** (button) — top-right corner

4. In the Add Rule panel, enter a rule name, select indexes, choose Spelling Correction, and confirm by clicking OK  
   - Element: **Spelling Correction** (checkbox) — rule configuration section  
   - Notes: If no intervention dictionary is specified, built-in dictionary is used. For invalid or unidentifiable errors, define an intervention dictionary.

5. After rule creation, run a search test to verify the query analysis process  
   - Element: **Run a search test** (button) — main content area  
   - Notes: View the process of query analysis via screenshots provided in the document.

6. Switch to Index Orientation and set the created rule as the default query analysis rule  
   - Element: **Index Orientation** (tab) — top navigation

7. Check the default query analysis rule to confirm it is active  
   - Notes: 

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Rule Name | text_input | Yes | — | Name for the new query analysis rule |
| Indexes | dropdown | Yes | — | Select one or more indexes to apply the rule to |
| Spelling Correction | checkbox | No | — | Enable spelling correction in the query analysis rule |

### Manage Analyzer

**Navigation**: Console > Search Algorithm Center > Retrieval Configuration > Analyzer Management

**Prerequisites**:
- Log on to the OpenSearch console

1. Navigate to the Search Algorithm Center section  
   - Element: **Search Algorithm Center** (menu) — left-side navigation pane

2. Select Retrieval Configuration from the submenu  
   - Element: **Retrieval Configuration** (menu) — left-side navigation pane

3. Click on Analyzer Management in the left-side pane  
   - Element: **Analyzer Management** (link) — left-side pane  
   - Notes: This displays both built-in and custom analyzers

### Configure Query Analysis (NL2SQL)

**Navigation**: AI Search Open Platform > Instance Info > RAG Model Service Configuration > Create New Service

**Prerequisites**:
- Access to the AI Search Open Platform console
- Basic understanding of database schema and business data structure

1. Navigate to the RAG Model Service Configuration page and click Create New Service  
   - Element: **Create New Service** (button) — top-right corner

2. Enter a service name such as student_info_analysis  
   - Element: **Service Name** (text_input) — main content area  
   - Notes: The name must be unique and follow naming conventions: lowercase letters, digits, underscores only, max 30 characters

3. Click Next to proceed to the next step  
   - Element: **Next** (button) — bottom of form

4. Configure basic table information using JSON format  
   - Element: **Basic Table Configuration** (text_input) — main content area  
   - Notes: Must include table name, columns with type, description, example, and value_mapping. Table and column names must start with lowercase letter and contain only lowercase letters, digits, or underscores.

5. Configure table join relationships using JSON array  
   - Element: **Table Join Configuration** (text_input) — main content area  
   - Notes: Format: ["table1.field=table2.field"]

6. Click Next to proceed to custom rules and training samples  
   - Element: **Next** (button) — bottom of form

7. Add training samples with queries and corresponding SQL statements  
   - Element: **Training Sample Configuration** (text_input) — main content area  
   - Notes: Use JSON array format with 'query' and 'sql' fields

8. Add custom rules (glossary) for business-specific terms and concepts  
   - Element: **Custom Rule Configuration** (text_input) — main content area  
   - Notes: Use JSON array with 'key' and 'value' fields; e.g., "Model student": "students.id <= 10"

9. Click Finish to complete configuration and activate the service  
   - Element: **Finish** (button) — bottom of form

10. Click Activate to start activation process  
    - Element: **Activate** (button) — service list  
    - Notes: Status changes from Activating to Activated after validation

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Service Name | text_input | Yes | — | Unique identifier for the NL2SQL service. Must be lowercase, alphanumeric, or underscore, max 30 characters. |
| Basic Table Configuration | text_input | Yes | — | JSON-formatted configuration of tables, including table name, columns with type, description, example, and value mapping. |
| Table Join Configuration | text_input | No | — | JSON array specifying join conditions between tables, e.g., ["students.class=schools.class"] |
| Training Sample Configuration | text_input | No | — | JSON array of query-SQL pairs to improve model accuracy. Each object contains 'query' and 'sql' fields. |
| Custom Rule Configuration | text_input | No | — | JSON array of business-specific term definitions. Each object has 'key' (term) and 'value' (definition). |

### Configure Fuzzy Query Analysis

**Navigation**: Console > Elasticsearch > Instance Management > Details > Modify Offline Application

**Prerequisites**:
- An offline application must be created and in Normal state
- Fields need to be mapped between application schema and data source

1. Click Details on the Instance Management page to view application details  
   - Element: **Details** (link) — on the Instance Management page

2. Click Modify Offline Application to start editing the application  
   - Element: **Modify Offline Application** (link) — on the application details page

3. Add multiple fields for querying and proceed to the next step  
   - Element: **Next** (button) — after adding fields  
   - Notes: In this example, add brand (SHORT_TEXT) and brand_text (TEXT) fields

4. Set the Analysis Method to Fuzzy Analyzer for the brand index and Chinese General for the brand_text index  
   - Element: **Fuzzy Analyzer** (dropdown) — on the Index Schema page  
   - Notes: The brand field is of SHORT_TEXT type and cannot use fuzzy query analysis

5. Click Next after setting up the indexes  
   - Element: **Next** (button) — after configuring indexes

6. Click Edit on the Data Source page to configure field mappings  
   - Element: **Edit** (button) — on the Data Source page

7. Map the newly created fields to the corresponding fields in the data source and click Completed  
   - Element: **Completed** (button) — in the edit dialog box

8. After the application state becomes Normal, configure a query analyzer  
   - Notes: Only available after the offline version is created and status is Normal

9. In the Edit Rule dialog box, enable Synonym as an enabled feature and specify an intervention dictionary  
   - Element: **Synonym** (checkbox) — in the Edit Rule dialog box  
   - Notes: Requires specifying an intervention dictionary for synonym configuration

10. Create an intervention entry for synonym configuration to test performance  
    - Notes: Used to validate the effectiveness of the configuration

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Analysis Method | dropdown | Yes | Fuzzy Analyzer, Chinese General | Specifies the text analysis method used for indexing the field |
| Enabled Features | checkbox | No | Synonym | Enables additional features such as synonym expansion during query processing |

## FAQ

Q: Where do I find the editable dictionary version for custom tokenization?
A: Look for the version named `_offline_adv_edit` in the Advanced Configurations section under Configuration Center. Only this version can be modified.

Q: What happens if I leave the Remark field empty when publishing a dictionary?
A: The system will still publish the version, but it’s recommended to add a descriptive remark to track changes across versions like _offline_adv_v2, _offline_adv_v3, etc.

Q: Can I modify an intervention dictionary after it’s been associated with a query analysis rule?
A: Yes, you can update entries in the dictionary at any time. However, you must re-run search tests and ensure the rule remains effective after changes.

Q: What permissions do I need to manage dictionaries and analyzers?
A: You need administrative or operator-level permissions for the OpenSearch instance, including access to Search Algorithm Center, Retrieval Configuration, and Dictionary Management.

Q: Why isn’t my custom stop word being ignored in search results?
A: Ensure the intervention dictionary is correctly associated with an active query analysis rule and that the Intervention Type is set to "Add". Also verify the rule is set as the default for your index.

## Pricing & Billing

### Billing Model
- Industry Analyzer: Billed per instance hour under Retrieval Engine Edition (0.08 /)
- NL2SQL Service: Billed per request (0.0001 / input + 0.0001 / output)
- Spelling Correction: Billed per request (0.0001 / input + 0.0001 / output)
- Fuzzy Query Analysis: Billed per request (0.0001 / input + 0.0002 / output)
- All dictionary management and analyzer configuration features (custom dictionaries, NER, synonyms, term weight, etc.) are free and included in the base OpenSearch service

### Free Tier
- NL2SQL Service: 1000 free requests per month
- Spelling Correction: 1000 free requests per month
- Fuzzy Query Analysis: 1000 free queries per month

### Quota Limits
- Industry Analyzer: Max 100 indexes per instance
- Intervention Dictionaries: Max 20 per account (for spelling, stop words, synonyms); max 10 for category prediction
- Dictionary Entries: Up to 1,000 per dictionary (spelling, stop words, synonyms); 500 for category prediction
- NL2SQL Service: Max 10 training samples per service, each up to 1000 characters
- Fuzzy Query: Max 8192 characters per request

### Billing Notes
- Using industry analyzers requires a Retrieval Engine Edition instance but incurs no extra charge beyond the instance hourly rate
- Query analysis features (spelling correction, fuzzy query, NL2SQL) are billed per invocation, even if no results are returned
- Dictionary management and analyzer configuration do not incur additional charges beyond standard OpenSearch usage fees