Skip to main content
net10.0

OpenSearch vector provider for Koan: plan-bound complete points, native filtered k-NN search, normalized similarity, and session-visible mutations.

Published
Sep 12, 2026
1mo ago
Total Downloads
3.5K
3,522

Install

dotnet add package Sylin.Koan.Data.Connector.OpenSearch --version 1.0.54
ProductVersions
.NET
net10.0

README

Sylin.Koan.Data.Connector.OpenSearch

OpenSearch vector storage for Koan Entities. The application declares one vector space; the connector realizes that plan through OpenSearch knn_vector, native kNN search, and native metadata pre-filtering.

  • Target framework: net10.0
  • License: Apache-2.0

Install

dotnet add package Sylin.Koan.Data.Connector.OpenSearch

Use

builder.Services.AddKoan(koan => koan.Data
    .Source("Search")
    .Vector<Article>(space => space
        .Name("content")
        .Dimensions(1536)
        .Metric(VectorMetric.Cosine)
        .Visibility(VectorVisibility.Session)));

await Vector<Article>.Save("article-1", embedding, new { category = "docs" });

var nearest = await Vector<Article>.Search(
    embedding,
    query => query.Top(5).Where(Filter.Eq("category", "docs")));

The space declaration owns its name, dimensions, metric, model, source, and visibility. Standard source declarations own access and storage lifecycle. OpenSearch configuration owns only placement, credentials, timeouts, and bounded work limits.

Configuration

{
  "Koan": {
    "Data": {
      "OpenSearch": {
        "Endpoint": "https://search.example.net:9200",
        "ApiKey": "use-your-secret-provider",
        "TimeoutSeconds": 30,
        "MaxSearchCandidates": 10000
      }
    }
  }
}

HTTP Basic authentication uses Username and Password. ConnectionStrings:OpenSearch remains an endpoint alternative. Standard named-source routing can select a different endpoint and credentials without changing Entity code. Keep credentials in the platform secret store.

Guarantees

  • complete point reads return logical identity, embedding, and neutral metadata;
  • Cosine, Euclidean, and unrestricted DotProduct spaces use explicit native mappings and normalized higher-is-closer scores;
  • awaited mutations use explicit refresh and are visible to subsequent Session reads;
  • Eq, Ne, ranges, In, Nin, Has, HasAny, HasAll, HasNone, Size, and Exists run as native kNN pre-filters; unsupported filters fail closed;
  • single and bulk upsert/delete preserve ordered outcomes; bulk atomicity is reported as not guaranteed;
  • Managed sources may create storage, External sources validate only, and ReadOnly sources reject mutations before I/O;
  • source, partition, container, and row scopes isolate every read and mutation path;
  • requests, responses, metadata, batches, candidates, retries, and tie expansion are bounded.

Deliberate limits

  • This is a Vector adapter, not a general OpenSearch Entity adapter.
  • Search accuracy is approximate because OpenSearch uses indexed approximate kNN.
  • Eventual visibility, hybrid text search, continuation snapshots, streaming export, and atomic batches are not claimed.
  • The adapter generates and validates its write alias and backing index. There is no ordinary index-name, field-name, dimension, metric, refresh, or auto-create option.
  • Existing external mappings must carry the Koan contract marker and match the declared space exactly.

Reference

Changes from Previous Version

No structural changes between v1.0.51 and v1.0.54.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.The published metadata declares 22 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.