All Products
Search
Document Center

OpenSearch:Vector search

Last Updated:Jun 10, 2026

OpenSearch vector search retrieves results by matching vector similarity rather than keywords. Combined with multi-channel recall, it improves accuracy in scenarios such as educational question answering and image search. This topic describes the vector query syntax and usage notes.

Syntax

query = vector_index:'vector'&vector_search={"vector_index":{"namespaces":[],"threshold":0.5,"top_n":10,"search_params":{}}}

The optional vector_search parameter configures vector index queries. It takes a dictionary where the key is the vector index name and the value is the query configuration. The following table describes the configuration parameters.

Parameter

Type

Default

Description

namespaces

list<string>

Partitions a vector index so that queries target specific partitions only. Maximum: 10,000 namespaces. If namespaces are configured, you must specify one in each query.

threshold

float

Minimum score threshold. Results scoring below this value are excluded.

top_n

uint32

Number of top results to return.

search_params.qc_scan_ratio

float

0.01

Ratio of documents to scan during a QC index query. Scanned documents = Total number of documents * scan_ratio.

search_params.hnsw_ef

uint32

500

Number of documents to scan during an HNSW index query. Higher values improve recall but increase latency.

Note

The vector_search parameter is also valid in multi-channel recall scenarios.

Example: Query a 64-dimensional vector index

vector: '0.377796,-0.958450,0.409853,-0.238177,-1.293826,0.356797,-0.295727,0.847301,-1.220337,0.148032,-1.128458,0.903187,0.509352,0.293686,-1.005852,-0.488839,0.888227,-0.555556,-0.658025,0.267552,-0.567601,0.003045,0.591734,-0.515983,-1.316453,-1.462450,0.091946,1.554954,0.384802,0.720498,0.144338,1.217826,0.724039,0.044212,0.571332,-1.425430,0.618965,0.481887,-1.617787,1.505416,-0.683652,1.030900,0.562021,0.162437,0.816546,0.112229,-0.739288,-0.342643,-0.199292,0.508368,-1.384887,-1.842170,0.952622,-1.699499,0.199430,-0.232464,-0.273227,-0.383696,-0.511302,0.005458,1.873572,-0.926169,-0.417587,-0.660156'

Examples

Set a minimum score threshold

Description: Excludes results with a vector distance score below the specified threshold.

Old parameter format: &sf=number

New parameter format: vector_search={"vector_index":{"threshold":0.8}}

Example:

// Old version
query=index_name:'0.1,0.2,0.98,0.6;0.3,0.4,0.98,0.6&sf=0.8'
// New version
query=index_name:'0.1,0.2,0.98,0.6;0.3,0.4,0.98,0.6'&vector_search={"index_name":{"threshold":0.8}}

Specify a top-N query

Description: Returns only the top N results.

Old parameter format: &n=number

New parameter format: vector_search={"vector_index":{"top_n":10}}

Example:

// Old version
query=vector_index:'0.1,0.2,0.98,0.6;0.3,0.4,0.98,0.6&n=10'
// New version
query=vector_index:'0.1,0.2,0.98,0.6;0.3,0.4,0.98,0.6'&vector_search={"index_name":{"top_n":10}}

Sort results by vector score

Description: Obtain the vector distance score by using proxima_score(index_name) in the fine sort expression.

  • index_name: The vector index name.

  • Returns a float vector distance score. Documents not returned by vector search default to a score of 10,000.

  • Example: proxima_score(your_vector_index).

Procedure:

Go to Search Algorithm Center > Sort Configuration > Policy Configuration and click Create. Set the scope to Default fine sort and the type to Expression.

  1. On the Search Test page, reference the fine sort policy you created and run a test.

On the Search Test page, set second_rank_name to the fine sort policy you created, then run a vector search query. Compare the results between the default and custom policies. If the results show SecondRank: expression[proxima_score(vec)], result[100.000000], the vector distance score is in effect.

Note
  • The default distance metric is Euclidean distance (l2).

  • For inner product distance (ip), a higher score indicates higher relevance.

  • For Euclidean distance (l2), a lower score indicates higher relevance.

Limits

  • The default distance metric is Euclidean distance (l2). To use inner product distance (ip), normalize your vectors before ingestion.

  • The vector index field must be of the DOUBLE_ARRAY type.

  • Supported dimensions: 64, 128, 256, and 512. The element count in the DOUBLE_ARRAY field must exactly match the specified dimension.

  • Maximum query vector string length: 4 KB before encoding. A single query typically supports up to two vector indexes.