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.