Skip to content

Vector Database

To use the Search module, you must configure a vector database. A detailed explanation of why this setup is required is provided on the Architecture page. The complete YAML configuration is documented on the Configuration page.

service
|   └── search
|   |   └── vectorDatabase
|   |   |   └── type
|   |   |   └── milvus
|   |   |   |   └── user
|   |   |   |   └── password
|   |   |   |   └── token
|   |   |   |   └── endpoint
|   |   |   |   └── consistency
|   |   |   |   └── reload
|   |   |   |   └── index
|   |   |   |   |   └── type
|   |   |   |   |   └── params
|   |   |   |   |   |   └── nlist
|   |   |   |   └── search
|   |   |   |   |   └── type
|   |   |   |   |   └── params
|   |   |   |   |   |   └── nprobe
|   |   |   └── opensearch
|   |   |   |   └── awsAuth
|   |   |   |   |   └── accessKey
|   |   |   |   |   └── enabled
|   |   |   |   |   └── region
|   |   |   |   |   └── secretKey
|   |   |   |   └── dimension
|   |   |   |   └── host
|   |   |   |   └── password
|   |   |   |   └── port
|   |   |   |   └── useSsl
|   |   |   |   └── username
|   |   |   |   └── verifyCerts
|   |   |   └── atlas
|   |   |   |   └── connectionString

The following vector database types are supported:

  • Milvus. A Milvus deployment typically includes the Milvus Operator, MinIO, etcd, and Pulsar components. It can run on-premises or in the cloud (for example, on Google Cloud Platform or Amazon Web Services). Trial credits are available in the AWS Ohio region, but you may choose another region if needed.

  • OpenSearch: Minimum supported version is 2.19.0

  • MongoDB Atlas

To enable a specific database type, configure the corresponding parameters in the YAML file as described below. All stored data is de-identified and represented only as vectors.

Note

Milvus and OpenSearch credentials can be provided through environment variables. These variables have priority over the corresponding values specified in config.yaml:

  • FACEAPI_MILVUS_USER
  • FACEAPI_MILVUS_PASSWORD
  • FACEAPI_MILVUS_TOKEN
  • FACEAPI_OPENSEARCH_USERNAME
  • FACEAPI_OPENSEARCH_PASSWORD

OpenSearch does not provide token-based authentication out of the box. When using AWS OpenSearch, use AWS authentication with accessKey and secretKey.

Parameter Type Default Description
vectorDatabasetype string milvus, opensearch, atlas The vector database type.
milvususer string The user for connecting to the Milvus instance. If both user and password are provided, the system will include the corresponding header in every RPC call.

Can be set using the FACEAPI_MILVUS_USER environment variable, which has priority over the value specified in config.yaml.
milvuspassword string The password corresponding to the specified user.

Can be set using the FACEAPI_MILVUS_PASSWORD environment variable, which has priority over the value specified in config.yaml.
milvustoken string Serves as the key for identification and authentication purposes. When a token is provided, the system adds the corresponding header to each RPC call. Users can use either user+password or token. If both are filled, the system logs in using user+password.

Can be set using the FACEAPI_MILVUS_TOKEN environment variable, which has priority over the value specified in config.yaml.
milvusendpoint string http://localhost:19530 The endpoint URL for the Milvus instance.
milvusconsistency string "Bounded" The consistency level to use when searching in a collection. Options for consistency level include Strong, Bounded, Eventually, Session, and Customized.
milvusreload boolean false If set to true, checks that collections for searching are in memory and loads them if not. If set to false, this option is disabled.
milvusindex map Parameters for the index to achieve better search performance.
indextype string "IVF_FLAT" Index type, see the Milvus documentation for details.
indexparamsnlist integer 128 Number of cluster units, see the IVF_FLAT article for details.
searchtype string "L2" The similarity metric type, metrics used to measure similarity of vectors, see the Similarity Metrics article for details.
searchparamsnprobe integer 5 Number of units to query, see the IVF_FLAT article for details.
opensearchawsAuthaccessKey string AWS access key ID used for authenticating requests to an OpenSearch cluster that is protected with AWS SigV4.
opensearchawsAuthenabled boolean false Enables AWS SigV4 authentication for OpenSearch. Set to true when using AWS OpenSearch with access key and secret key authentication.
opensearchawsAuthregion string AWS region where the OpenSearch cluster is hosted (for example, us-east-1). Required when awsAuth.enabled is true.
opensearchawsAuthsecretKey string AWS secret access key paired with the access key ID. Used to sign requests to OpenSearch.
opensearchpassword string "" Password for the specified OpenSearch user.

Can be set using the FACEAPI_OPENSEARCH_PASSWORD environment variable, which has priority over the value specified in config.yaml.
opensearchusername string admin Username for OpenSearch authentication.

Can be set using the FACEAPI_OPENSEARCH_USERNAME environment variable, which has priority over the value specified in config.yaml.
opensearchdimension integer 512 Dimensionality of the vector embeddings stored in the OpenSearch k-NN index. Must match your model’s embedding size.
opensearchhost string localhost OpenSearch host name or IP.
opensearchport string "9200" OpenSearch port.
opensearchuseSsl boolean false Whether to enable HTTPS.
opensearchverifyCerts boolean false Whether to verify server SSL certificates when useSsl is true.
atlasconnectionString string MongoDB Atlas connection string, for example, mongodb+srv://<user>:<password>@<cluster>/<db>?retryWrites=true&w=majority&appName=<app>.