ladderlore
  • 输入服务名称,例如 S3 或 IAM。

服务 · Analytics · 基于 AIF-C01

Amazon OpenSearch Service

Set up k-NN: index fields, HNSW or IVF, engines, metrics, serverless or domain, hybrid queries.

本课尚未翻译,暂以英文显示。

你在AI Practitioner中已学过

  • OpenSearch stores documents and can store embeddings next to them.
  • It supports keyword, semantic and hybrid search.
  • It runs as a managed domain or as OpenSearch Serverless.
阅读AI Practitioner课程
Question
Embedding model
k-NN search
Keyword search
Blended results
A hybrid query runs a k-NN and a keyword search, then blends the results.
  • Capacity

    Serverless
    Scales in OCUs
    Managed domain
    You pick instances
  • Shards

    Serverless
    Managed for you
    Managed domain
    You set them at creation
  • Setup

    Serverless
    Collection and policies
    Managed domain
    Domain and access
  • Pick it for

    Serverless
    Less to operate
    Managed domain
    Tuning and control
Serverless collection and managed domain side by side.

1 / 2

  • Capacity

    Serverless
    Scales in OCUs
    Managed domain
    You pick instances
  • Shards

    Serverless
    Managed for you
    Managed domain
    You set them at creation
  • Setup

    Serverless
    Collection and policies
    Managed domain
    Domain and access

2 / 2

  • Pick it for

    Serverless
    Less to operate
    Managed domain
    Tuning and control
Serverless collection and managed domain side by side.

是什么

To search vectors, create an index with index.knn set to true and a field of type knn_vector. The field has a dimension, which must equal the embedding model output, a method, an engine and a distance metric. The method is HNSW, a graph that gives fast, accurate search but keeps graphs in memory, or IVF, which groups vectors into clusters, needs a training step and uses less memory. Engines are Faiss (HNSW and IVF) and Lucene (HNSW). Metrics are L2 distance, cosine similarity and inner product: use the one the embedding model was trained for.

是什么

Memory is the main sizing issue. On a managed domain, k-NN graphs live outside the Java heap and can use up to half of the remaining memory by default, so size instances to hold the graphs, and watch the KNNGraphMemoryUsage metric. The number of primary shards is fixed when the index is created, and replicas add read capacity and resilience. OpenSearch Serverless offers a vector search collection: it manages shards and scaling for you, and you pay by OpenSearch Compute Units. A domain gives you control over instance types and shards.

是什么

A k-NN query returns the k nearest vectors, with k up to 10,000, and set size too, or you get k results per shard. For hybrid search, combine a keyword (BM25) query with a k-NN query, and normalize and blend the scores in a search pipeline. This finds both exact terms such as product codes and similar meanings.

要记住

  • Index needs index.knn true and a knn_vector field with a dimension.
  • HNSW: fast and accurate, memory heavy. IVF: clusters, training step, less memory.
  • Engines: Faiss (HNSW, IVF), Lucene (HNSW). Metrics: L2, cosine, inner product.
  • Graph memory sets instance size. Primary shard count is fixed at index creation.

要记住

  • Serverless vector collection: no shards to manage. Domain: you choose instances and shards.
  • Hybrid: keyword query plus k-NN query, with blended scores.

考试中

  • “Queries fail after switching the embedding model” points to a dimension mismatch with the knn_vector field.
  • “No cluster to size or patch for vector search” points to an OpenSearch Serverless vector search collection.
  • “Find product codes and also similar meanings” points to hybrid search.