Files
seaweedfs/weed/pb/vector.proto
T
Chris Lu 4e89e94535 S3 Vectors: opt in to indexed-only searches (#12932)
* vector: restrict indexed-only searches to shared index coverage

* vector: expose indexed-only queries through a compatible backend RPC

* s3vectors: accept signed indexed-only search requests

* s3vectors: document indexed-only queries and exercise SDK signing

* vector: expose restricted ANN execution for enterprise ownership

* vector: score unscored hits within the query scope

* s3vectors: verify search mode in the SigV4 authenticator

* s3vectors: resolve table descriptors for indexed-only queries

* vector: recover short results within a fragment restriction

* vector: avoid a fragment prefilter for fully indexed unfiltered queries

* docs: remove the boto3 signing hook after query errors

* vector: recover short indexed-only results with full coverage
2026-11-24 12:58:13 -08:00

207 lines
5.5 KiB
Protocol Buffer

syntax = "proto3";
package vector_pb;
option go_package = "github.com/seaweedfs/seaweedfs/weed/pb/vector_pb";
import "google/protobuf/struct.proto";
// The shared contract between the Go S3 gateway and the vector query engine.
// The public S3 Vectors API stays an AWS contract; this RPC is the internal
// boundary the design doc gives both editions.
service VectorService {
rpc CreateIndex(CreateIndexRequest) returns (CreateIndexResponse);
rpc DropIndex(DropIndexRequest) returns (DropIndexResponse);
rpc PutVectors(PutVectorsRequest) returns (PutVectorsResponse);
rpc GetVectors(GetVectorsRequest) returns (GetVectorsResponse);
rpc DeleteVectors(DeleteVectorsRequest) returns (DeleteVectorsResponse);
rpc ListVectors(ListVectorsRequest) returns (ListVectorsResponse);
rpc QueryVectors(QueryVectorsRequest) returns (QueryVectorsResponse);
rpc QueryIndexedVectors(QueryVectorsRequest) returns (QueryVectorsResponse);
// How this engine's queries of an index filtered on each metadata key
// over the last hour.
rpc FilterStats(FilterStatsRequest) returns (FilterStatsResponse);
// The index's indexed metadata keys, as its Lance table records them.
rpc MetadataKeys(MetadataKeysRequest) returns (MetadataKeysResponse);
// Ask for a metadata key to be indexed, or no longer: the table records
// the request and the maintenance worker carries it out.
rpc UpdateMetadataKey(UpdateMetadataKeyRequest) returns (MetadataKeysResponse);
}
enum DistanceMetric {
DISTANCE_METRIC_UNSPECIFIED = 0;
L2 = 1;
COSINE = 2;
DOT_PRODUCT = 3;
}
// Table addresses a Lance table through the namespace: the id parts as the
// namespace catalog joins them. The gateway resolves the table before it
// calls, so the engine opens it without a catalog round trip of its own.
message Table {
repeated string id = 1;
// Dataset version to pin reads to; 0 means latest.
uint64 version = 2;
// The table's Lance location, as the catalog describes it.
string location = 3;
reserved 4;
reserved "storage_options";
// The bucket encrypts its objects with SSE-S3; the engine writes the
// table's files that way.
bool sse_s3 = 5;
}
message CreateIndexRequest {
Table table = 1;
uint32 dimension = 2;
DistanceMetric distance_metric = 3;
repeated string non_filterable_metadata_keys = 4;
}
message CreateIndexResponse {
uint64 version = 1;
}
message DropIndexRequest {
Table table = 1;
}
message DropIndexResponse {}
message Vector {
string key = 1;
repeated float data = 2;
// JSON-typed metadata: numbers carry double precision, as on the wire.
google.protobuf.Struct metadata = 3;
}
message PutVectorsRequest {
Table table = 1;
repeated Vector vectors = 2;
}
message PutVectorsResponse {
uint64 version = 1;
}
message GetVectorsRequest {
Table table = 1;
repeated string keys = 2;
bool return_data = 3;
bool return_metadata = 4;
}
message GetVectorsResponse {
repeated Vector vectors = 1;
}
message DeleteVectorsRequest {
Table table = 1;
repeated string keys = 2;
}
message DeleteVectorsResponse {
uint64 version = 1;
}
message ListVectorsRequest {
Table table = 1;
uint32 max_results = 2;
string next_token = 3;
bool return_data = 4;
bool return_metadata = 5;
// A nonzero segment_count lists only the rows whose position modulo
// segment_count is segment_index; next_token stays a row position.
uint32 segment_count = 6;
uint32 segment_index = 7;
}
message ListVectorsResponse {
repeated Vector vectors = 1;
string next_token = 2;
// Set when segment_count was applied; an older engine ignores it.
bool segmented = 3;
}
message QueryVectorsRequest {
Table table = 1;
repeated float query_vector = 2;
uint32 top_k = 3;
// Lance SQL filter; empty means unfiltered. Metadata is one JSON
// `metadata` column, so the gateway translates S3 Vectors filter
// expressions onto it before they land here.
string filter = 4;
// Lance's post-filter escape hatch; off prefilters, matching S3 Vectors.
bool postfilter = 5;
bool return_metadata = 6;
bool return_distance = 7;
bool return_data = 8;
}
message QueryResult {
string key = 1;
float distance = 2;
google.protobuf.Struct metadata = 3;
repeated float data = 4;
}
message QueryVectorsResponse {
repeated QueryResult vectors = 1;
}
message FilterStatsRequest {
// Only the id is read.
Table table = 1;
}
message FilterKeyStats {
string key = 1;
uint64 queries = 2;
// Their total latency.
double seconds = 3;
// The operand types the key was compared with.
bool string_operand = 4;
bool number_operand = 5;
bool bool_operand = 6;
}
message FilterStatsResponse {
repeated FilterKeyStats keys = 1;
// The stats cover at most this long, less when the engine started later.
uint32 window_seconds = 2;
// Keys of this index not counted because the engine tracks a bounded
// number of them.
bool truncated = 3;
}
message MetadataKeysRequest {
Table table = 1;
}
message MetadataKey {
string key = 1;
// requested, building, ready or off.
string state = 2;
// The hidden column holding the key; empty while requested.
string column = 3;
// Rows the key's scalar index covers, of the table's rows.
uint64 indexed_rows = 4;
uint64 rows = 5;
uint64 index_bytes = 6;
uint32 segments = 7;
}
message MetadataKeysResponse {
repeated MetadataKey keys = 1;
uint64 version = 2;
// The table's rows, and its vector index type (empty without one).
uint64 rows = 3;
string vector_index = 4;
}
message UpdateMetadataKeyRequest {
Table table = 1;
string key = 2;
bool remove = 3;
}