All Downloads are FREE. Search and download functionalities are using the official Maven repository.

.avs-client-java.1.1.0.source-code.types.proto Maven / Gradle / Ivy

Go to download

This project includes the Java client for Aerospike Vector Search for high-performance data interactions.

The newest version!
syntax = "proto3";

package aerospike.vector;

option go_package = "aerospike.com/vector/protos/";
option java_package = "com.aerospike.vector.client.proto";
option java_multiple_files = true;

// A record key.
message Key {
  // The storage namespace.
  string namespace = 1;

  // Optional storage set.
  optional string set = 2;

  // The key value.
  oneof value {
    string stringValue = 3;

    bytes bytesValue = 4;

    int32 intValue = 5;

    int64 longValue = 6;
  }
}

// A list of boolean data values.
message BoolData {
  repeated bool value = 1;
}

// A list of floating point data values.
message FloatData {
  repeated float value = 1;
}

// A key in a map type value.
message MapKey {
  oneof value {
    string stringValue = 1;

    bytes bytesValue = 2;

    int32 intValue = 3;

    int64 longValue = 4;

    float  floatValue = 5;

    double doubleValue = 6;
  }
}

// A map entry.
message MapEntry {
  MapKey key = 1;
  Value value = 2;
}

// A map/dictionary type.
message Map {
  repeated MapEntry entries = 1;
}

// A list type.
message List {
  repeated Value entries = 1;
}

// A vector.
message Vector {
  // Vector data
  oneof data {
    BoolData boolData = 1;
    FloatData floatData = 2;
  }
}

// A data value.
message Value {
  oneof value {
    string stringValue = 1;

    bytes bytesValue = 2;

    int32 intValue = 3;

    int64 longValue = 4;

    float  floatValue = 5;

    double doubleValue = 6;

    Map mapValue = 7;

    List listValue = 8;

    Vector vectorValue = 9;

    bool booleanValue = 10;
  }
}

// A field in the record.
message Field {
  string name = 1;
  Value value = 2;
}

// Metadata associated with records stored in Aerospike DB.
message AerospikeRecordMetadata {
  // Record modification count.
  uint32 generation = 1;

  // Date record will expire, in seconds from Jan 01 2010 00:00:00 GMT.
  uint32 expiration = 2;
}

// A single database record.
message Record {
  // Record fields.
  repeated Field fields = 1;

  // Record metadata.
  oneof metadata {
    AerospikeRecordMetadata aerospikeMetadata = 2;
  }
}

// A neighbor result returned by vector search.
message Neighbor {
  // The result record key.
  Key key = 1;

  // The result record, will be missing if no record corresponding to the key is
  // found.
  optional Record record = 2;

  // The distance from the query vector.
  float distance = 3;
}

// Unique identifier for an index.
message IndexId {
  // The index namespace.
  string namespace = 1;

  // The name of the index. This should be unique within the namespace.
  string name = 2;
}

// Available vector distance metrics.
enum VectorDistanceMetric {
  SQUARED_EUCLIDEAN = 0;
  COSINE = 1;
  DOT_PRODUCT = 2;
  MANHATTAN = 3;
  HAMMING = 4;
}

// Available index types.
enum IndexType {
  HNSW = 0;
}

// Params for the HNSW index
message HnswParams {
  // Maximum number bi-directional links per HNSW vertex. Greater values of
  // 'm' in general provide better recall for data with high dimensionality, while
  // lower values work well for data with lower dimensionality.
  // The storage space required for the index increases proportionally with 'm'.
  // The default value is 16.
  optional uint32 m = 1;

  // The number of candidate nearest neighbors shortlisted during index creation.
  // Larger values provide better recall at the cost of longer index update times.
  // The default is 100.
  optional uint32 efConstruction = 2;

  // The default number of candidate nearest neighbors shortlisted during search.
  // Larger values provide better recall at the cost of longer search times.
  // The default is 100.
  optional uint32 ef = 3;

  // Configures batching behaviour for batch based index update.
  HnswBatchingParams batchingParams = 4;

  // Maximum size of in-memory queue for inserted/updated vector records.
  // If the queue is full the record upsert will either be rejected with
  // a RESOURCE_EXHAUSTED error or written to storage for index healer to
  // later pick the record for indexing based on the put option.
  // Defaults to global indexing config configured for the VectorDB.
  optional uint32 maxMemQueueSize = 5;

  // Configures caching for Hnsw Index. It is turned on by default with maximum
  // 2 million entries and 1 hour expiry.
  HnswCachingParams indexCachingParams = 6;

  // Configures index healer params.
  HnswHealerParams healerParams = 7;

  // Configures merge of batch indices to main index.
  HnswIndexMergeParams mergeParams = 8;

  // Verify whether the underlying vector has changed before returning the kAnn
  // result. Defaults to true.
  optional bool enableVectorIntegrityCheck = 9;

  // Configures caching for vector records. It is turned off by default.
  optional HnswCachingParams recordCachingParams = 10;
}

// Params for the HNSW index search.
message HnswSearchParams {
  // The default number of candidate nearest neighbors shortlisted during search.
  // Larger values provide better recall at the cost of longer search times.
  // The default is value set in HnswParams for the index.
  optional uint32 ef = 1;
}

// Params to configure Hnsw batch index into main index.
message HnswIndexMergeParams {
  // The number of vectors merged in parallel from an indexing record
  // batch-index to the main index.
  // Defaults to global indexing config configured for the VectorDB.
  optional uint32 indexParallelism = 1;

  // The number of vectors merged in parallel from a re-indexing record
  // batch-index to the main index.
  // Defaults to global re-indexing config configured for the VectorDB.
  optional uint32 reIndexParallelism = 2;
}

// Params to configure Hnsw index cache
message HnswCachingParams {
  // Maximum number of entries to cache.
  // Defaults to the global cache config configured for the VectorDB.
  optional uint64 maxEntries = 1;

  // A cache entry will expire after this time in milliseconds has
  // expired after the entry was added to cache.
  // Defaults to the global cache config configured for the VectorDB.
  optional int64 expiry = 2;
}

// Params to configure Hnsw index cache
message HnswHealerParams {
  // Maximum allowed record scan rate per vector db node.
  // Defaults to the global healer config configured for the VectorDB.
  optional uint32 maxScanRatePerNode = 1;

  // Maximum number of records in a single scanned page.
  // Defaults to the global healer config configured for the VectorDB.
  optional uint32 maxScanPageSize = 2;

  // Percentage of good records randomly selected for reindexing in a healer cycle.
  // Defaults to the global healer config configured for the VectorDB.
  optional float reindexPercent = 3;

  // The quartz cron expression defining schedule at which the healer cycle is
  // invoked.
  // Defaults to the global healer config configured for the VectorDB.
  optional string schedule = 4;

  // Maximum number of records to heal in parallel.
  // Defaults to the global healer config configured for the VectorDB.
  optional uint32 parallelism = 5;
}

// Configures batching behaviour for batch based index update.
message HnswBatchingParams {
  // Maximum number of index records to fit in a batch.
  // The default value is 100_000 and can't be less than 1000.
  optional uint32 maxIndexRecords = 1;

  // The maximum amount of time in milliseconds to wait before finalizing a
  // index records batch.
  // The default value is 30000 and can't be less than 10000.
  optional uint32 indexInterval = 2;

  // Maximum number of reindex records to fit in a batch.
  // The default value is max(maxIndexRecords / 10, 1000).
  optional uint32 maxReindexRecords = 3;

  // The maximum amount of time in milliseconds to wait before finalizing a
  // reindex records batch.
  // The default value is indexInterval and can't be less than 10000.
  optional uint32 reindexInterval = 4;
}

// Message to update a HNSW index parameters.
message HnswIndexUpdate {
  // Configures batching behaviour for batch based index update.
  optional HnswBatchingParams batchingParams = 1;

  // Maximum size of in-memory queue for inserted/updated vector records.
  // If the queue is full the record upsert will either be rejected with
  // a RESOURCE_EXHAUSTED error or written to storage for index healer to
  // later pick the record for indexing based on the put option.
  // Defaults to global indexing config configured for the VectorDB.
  optional uint32 maxMemQueueSize = 2;

  // Configures caching for Hnsw Index. It is turned on by default with maximum
  // 2 million entries and 1 hour expiry.
  optional HnswCachingParams indexCachingParams = 3;

  // Configures index healer params.
  optional HnswHealerParams healerParams = 4;

  // Configures merge of batch indices to main index.
  optional HnswIndexMergeParams mergeParams = 5;

  // Verify whether the underlying vector has changed before returning the kAnn
  // result. Defaults to true.
  optional bool enableVectorIntegrityCheck = 6;

  // Configures caching for vector records. It is turned off by default.
  optional HnswCachingParams recordCachingParams = 7;
}

// Index storage configuration
message IndexStorage {
  // Optional storage namespace where the index is stored.
  // Defaults to the index namespace.
  optional string namespace = 1;

  // Optional storage set where the index is stored.
  // Defaults to the index name.
  optional string set = 2;
}

// An index definition.
message IndexDefinition {
  // The index identifier.
  IndexId id = 1;

  // The type of index. Defaults to HNSW.
  optional IndexType type = 2;

  // Number of dimensions in data.
  // Vectors not matching the dimension count will not be indexed.
  uint32 dimensions = 3;

  // Optional The distance metric to use. Defaults to SQUARED_EUCLIDEAN.
  optional VectorDistanceMetric vectorDistanceMetric = 4;

  // Name of the record vector field to index.
  string field = 5;

  // Optional filter on Aerospike set name from which records will be indexed.
  // If not specified all sets in the index namespace will be indexed.
  optional string setFilter = 6;

  // Index parameters.
  oneof params {
    HnswParams hnswParams = 7;
  }

  // Optional labels associated with the index.
  map labels = 8;

  // Index storage.
  optional IndexStorage storage = 9;
}

// List of index definitions.
message IndexDefinitionList {
  repeated IndexDefinition indices = 1;
}

// A role.
message Role {
  // Role's unique name/id
  string id = 1;
}

// A user.
message User {
  // User's username
  string username = 1;

  // Granted roles
  repeated string roles = 2;
}

// Authentication credentials.
message Credentials {
  string username = 1;
  oneof credentials {
    PasswordCredentials passwordCredentials = 2;
  }
}

// Password credentials.
message PasswordCredentials {
  string password = 1;
}

// A boolean type
message Boolean {
  bool value = 1;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy