All Products
Search
Document Center

OpenSearch:Vector-based query

Last Updated:Apr 01, 2026

Run vector-based queries from the Query Test page in the OpenSearch Vector Search Edition console to validate your index and data after reindexing completes.

Prerequisites

Before you begin, ensure that you have:

  • Completed reindexing for your OpenSearch instance

  • At least one table in the In Use state

Choose a query mode

The Query Test page offers two modes. Select the one that fits your use case before configuring query parameters:

ModeBest forLimitations
Form ModeQuick validation with a simple form UISingle vector, single namespace, single index only; returns all fields and vector data by default
Developer ModeFull control over query parameters via JSONNone — all query features are supported

To access the Query Test page, go to the details page of your OpenSearch instance and click Query Test in the left-side navigation pane. On the Vector-based Query tab, select the table to query from the Table Name drop-down list. In the upper-right corner, select Form Mode or Developer Mode. Form Mode is selected by default.

image

Run a query in Form mode

In Form Mode, query parameters appear as form fields and results display below the form.

image

Configure the following parameters:

ParameterRequiredDescription
Table NameYesThe table to query. Select a table in the In Use state.
Index NameYesAuto-populated when you select a table. No manual selection needed.
TopKYesMaximum number of results to return. Default: 10. Must be a positive integer.
Filter ConditionNoFilter expression to narrow results. Supported operators: >, <, =, <=, >=, !=. Use AND, OR, and () to combine conditions. See Filter expression.
Query TypeYesData type used for the query: Vector, Image, or Text.
NamespaceNoPartition namespace for the vector index.
Result Sort OrderYesSort order for results: ASC or DESC. Default: ASC.

Choosing the right sort order

The correct sort order depends on the distance type configured for your table:

  • Inner product — a higher score means higher relevance. Set to DESC.

  • Euclidean distance — a lower score means higher relevance. Set to ASC.

Query by vector

After you select a table, the index name is automatically populated. A tip below the Vector field shows the required number of vector dimensions.

image

Enter a vector value with the correct number of dimensions in the Vector field, then click Search. Results appear below the form.

image

Query by image

Image queries require the built-in embedding feature to be enabled on the selected table.

After you select a table, the index name is automatically populated. The Method for Providing Images parameter appears with two options: Upload Image File and Base64 Encoding (default).

image

Upload Image File

Click the blank area in the Upload Image section to upload a local image. Enable Multi-subject Recognition if needed, then click Search.

Note

Supported image formats: PNG, JPG, and JPEG. Maximum file size: 2 MB.

When Multi-subject Recognition is enabled:

  1. All detected subjects are framed and numbered.

  2. The subject with the highest pixel size is selected by default, and its results are displayed.

  3. Click a subject's number to switch to that subject. Results and the highlighted area update accordingly.

Base64 Encoding

image

Enter the Base64-encoded string of the image in the input field, then click Search. Results appear below the form.

image

Query by text

Text queries require the built-in embedding feature to be enabled on the selected table.

After you select a table, the index name is automatically populated. A tip below the Query Type field confirms that text queries require built-in embedding.

image

Enter the text to query in the Text field, then click Search. Results appear below the form.

image

Run a query in Developer mode

Developer Mode displays query parameters and results as raw JSON, giving you full access to all query features.

image

Enter your query JSON in the left panel, then click Search. Results appear in the right panel.

image

Single vector query

{
  "vector": [0.345263, 0.346272, 0.33663.....],
  "topK": 10,
  "indexName": "",
  "includeVector": true,
  "namespace": "test1"
}

Multiple vectors with namespaces

{
  "tableName": "gist",
  "indexName": "vec_index",
  "queries": [
    {
      "vector": [0.1, 0.2, 0.3],
      "namespace": "space_a"
    },
    {
      "vector": [0.4, 0.5, 0.6],
      "namespace": "space_b"
    }
  ],
  "topK": 3,
  "includeVector": true
}

JSON parameters

ParameterRequiredDescription
vectorYesVector value in list[float] format. The number of dimensions must match the vector index dimensions.
topKNoMaximum number of results to return. Default: 10.
indexNameNoName of the vector index.
includeVectorNoWhether to include vector data in results. Default: true.
namespaceConditionalRequired only if a category is configured for the instance.
tableNameNoTable name (used in multi-vector queries).
queriesNoList of vector-namespace pairs for multi-vector queries.

For the full parameter reference, see Vector-based query.

Form mode limitations and workarounds

The following limitations apply to Form Mode. Switch to Developer Mode to work around each one.

LimitationWorkaround in Developer Mode
Single namespace onlyUse the queries array to query multiple namespaces
Single vector index onlySpecify indexName per query
Single vector per queryUse the queries array for multi-vector queries
All fields returned by defaultControl field selection via query parameters
Vector data included in results by defaultSet "includeVector": false
Result scores are filtered by defaultUse Developer Mode for full score visibility