# opensearch-ranking

Part of **OPENSEARCH**

<!-- intent-backlink:auto -->

> 💡 **Path Selection**: This skill is one implementation path for [Optimize search relevance and ranking](../../intent/opensearch-optimize-relevance/SKILL.md). If you're unsure which path to take, check the routing skill first.

# OpenSearch Text Relevance Ranking Console Guide

## Operations Overview

| Operation | Console Entry | Prerequisites | Description |
|----------|---------------|---------------|-------------|
| Configure Pack Index with Text Fields and Relevance Scoring | Console > Elasticsearch > Index Management > Create Pack Index | A Vector Search Edition cluster is available; Fields 'vector_source_text' and 'cate_id' are defined in the index schema; Identical analysis methods are configured for both fields | Set up a PACK-type index to enable text relevance scoring using specific field configurations for improved search ranking |

## Operation Steps

### Configure Pack Index with Text Fields and Relevance Scoring

**Navigation**: Console > Elasticsearch > Index Management > Create Pack Index

**Prerequisites**:
- A Vector Search Edition cluster is available
- Fields `vector_source_text` and `cate_id` are defined in the index schema
- Identical analysis methods are configured for both fields

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

2. Click the button to create a new pack index  
   - Element: **Create Pack Index** (button) — top-right corner

3. Enter the index name and ensure the index type is set to PACK  
   - Element: **index_name** (text_input) — main content area  
   - Notes: The index type must be explicitly set to PACK for relevance scoring functionality

4. Add the required fields to the index fields list in the correct order  
   - Element: **index_fields** (text_input) — main content area  
   - Notes: Maintain the order: `vector_source_text` first, then `cate_id`. Both fields must use identical analysis methods.

5. Switch to the Advanced Configuration tab and set the required flags  
   - Element: **Advanced Configuration** (tab) — main content area  
   - Notes: After the tab expands, configure the following values: `doc_payload_flag=1`, `has_section_attribute=true`, `position_payload_flag=1`

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| index_name | text_input | Yes | — | The name of the pack index to be created |
| index_type | dropdown | Yes | PACK, DEFAULT | Select the type of index; must be PACK for this functionality |
| index_fields | form_field | Yes | — | List of fields to include in the pack index with their boost values |
| doc_payload_flag | checkbox | No | Enabled, Disabled | Whether to store document payload information (set to Enabled / value=1) |
| has_section_attribute | checkbox | No | True, False | Whether to enable section attribute configuration (set to True) |
| position_payload_flag | checkbox | No | Enabled, Disabled | Whether to store position payload information (set to Enabled / value=1) |

## FAQ

Q: Where can I find the option to create a pack index?  
A: Go to Console > Elasticsearch > Index Management, then click the **Create Pack Index** button in the top-right corner.

Q: What happens if I don’t include both `vector_source_text` and `cate_id` fields?  
A: Text relevance scoring will not function correctly. Both fields are required and must be added in the specified order with identical analysis methods.

Q: Can I change the index type after creation?  
A: No. The index type (e.g., PACK vs DEFAULT) must be selected during creation and cannot be modified afterward.

Q: Do I need special permissions to configure a pack index?  
A: You need write access to the Elasticsearch cluster and sufficient privileges to manage indices in the Vector Search Edition.

Q: Why are the advanced flags like `doc_payload_flag` important?  
A: These flags enable critical features for relevance scoring: `doc_payload_flag` stores document metadata, `has_section_attribute` supports structured content sections, and `position_payload_flag` preserves term positions for accurate scoring.

## Pricing & Billing

### Billing Model  
Pack index operations are billed per request.

### Price Reference  

| Tier | Input Price | Output Price | Other Price |
|------|-------------|--------------|-------------|
| standard | 0.0001 / | 0.0002 / | — |

### Free Tier  
 1000 

### Billing Notes  
Pack index operations are billed per request. Queries with `rank_trace:all` may incur higher costs due to additional processing.