Skip to main content

What is ES2?

ES2 (Encrypted Similarity Search) is a high-performance encrypted vector search engine designed to protect data privacy during similarity search. It enables users to search over encrypted vectors without ever exposing the raw data or query.

By leveraging advanced encryption techniques such as homomorphic encryption and secure computation, ES2 ensures that both the vector data and similarity scores remain confidential — even during computation.

ES2 is provided as a Python client package. For more details, visit https://heaan.com/.

ES2 Example

This example demonstrates the complete workflow of the ES2 Python SDK, showcasing its capabilities for encrypted similarity search and vector database operations.


Import ES2

At the very first time, you should install and import the es2 package to use Python APIs.

pip install es2
import es2

🔍 Vector Search

1. Initialize ES2

To use the ES2 service, initialization is required. This includes establishing a connection to the ES2 server and configuring settings necessary for vector search.

es2.init(
    host="localhost",
    port=50050,
    key_path="./keys",
    key_id="quickstart_key",
)

2. Create Index

You need to create an index before inserting data. The index is defined by its name and vector dimensionality.

index = es2.create_index("quickstart_index", dim=512)

3. Insert Data

You can insert random or real vectors into the created index. Below is an example using random 512-dimensional vectors with normalization and metadata.

import numpy as np

# Function to generate normalized random vectors
def generate_random_vector(dim):
    if dim < 32 or dim > 4096:
        raise ValueError(f"Invalid dimension: {dim}.")

    vec = np.random.uniform(-1.0, 1.0, dim)
    norm = np.linalg.norm(vec)

    if norm > 0:
        vec = vec / norm

    return vec

# Prepare sample data
num_data = 10
db_vectors = [generate_random_vector(512) for _ in range(num_data)]
db_metadata = [f"data_{i+1}" for i in range(num_data)]

# Insert into index
index.insert(db_vectors, metadata=db_metadata)

4. Encrypted Similarity Search

Use a query vector to find similar vectors. The index object enables encrypted search and decryption of scores on the client side.

query = db_vectors[1]
top_k = 2

result = index.search(query, top_k=top_k, output_fields=["metadata"])
print(result)

🧹 Clean Up

To remove test data and release keys, you can call:

es2.drop_index("quickstart_index")
es2.delete_key("quickstart_key")

Metadata

Release files for es2 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for es2 1.1.3
File
es2-1.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
es2-1.1.3-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details
es2-1.1.3-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
es2-1.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
es2-1.1.3-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details
es2-1.1.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
es2-1.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
es2-1.1.3-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details
es2-1.1.3-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
es2-1.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
es2-1.1.3-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details
es2-1.1.3-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
es2-1.1.3-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
es2-1.1.3-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details
es2-1.1.3-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details

Total release size: 79.4 MB

Release files / es2-1.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL es2-1.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.3 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
0069b366180c3d290e6ec59f039ef6cf4beb09deed7eaa3dc774232c5e89b3f4
BLAKE2b-256 checksum
How to use checksums
2266a8c2c5a901697bb25ad9ce1e01eb1866642b1794571fbb38e8335a9bdac6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL es2-1.1.3-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 5.9 MB
Tags CPython 3.13 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
bb428869709593b1beded54023ffbaf35181e716cc50693c95ceee1d24ee0fbd
BLAKE2b-256 checksum
How to use checksums
77e258b82aeb0f0aaeecbdedf28bba43a55fb755b3665d8df2c29da784eaa9b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp313-cp313-macosx_11_0_arm64.whl

Download URL es2-1.1.3-cp313-cp313-macosx_11_0_arm64.whl
Size 3.6 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ac9a0378ddc790885212d613a671c19cf04352a6b96d074c46e3e5aae60f6eaa
BLAKE2b-256 checksum
How to use checksums
be9119865222582f75ccea6c436a4e1bd1f64978aa724f30b27c5640e160856d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL es2-1.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.3 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
462d72eb68dd2f8b7ac502b52f6528e7cfa33c5097a0d18d62bd09190eb39fff
BLAKE2b-256 checksum
How to use checksums
89cc27d8b1d839350e51787a36d203e3c76724ac587aa3ea9935f232ad70a743
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL es2-1.1.3-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 5.9 MB
Tags CPython 3.12 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
47a39f1eb597c3ec203b3df1886e4f217844fc3cc198eb518337b47c034e1d3a
BLAKE2b-256 checksum
How to use checksums
389364fd8f9d59523ab952d2ae5838ae51fe81c9d51f853bc732443ff56dc1a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL es2-1.1.3-cp312-cp312-macosx_11_0_arm64.whl
Size 3.6 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8893f985b94b97541dc0fc8145eed68c078820ec47b5850ce0a2c585c3662fdb
BLAKE2b-256 checksum
How to use checksums
24ce12b1a890c6f50044c71c718409c87109968834ee26221e9a74bd8084c206
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL es2-1.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.3 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b304c56735570910fa33af077c3166cab1e7061fa727ce2fd3b394234fef0393
BLAKE2b-256 checksum
How to use checksums
93c05b223c8cc77a3806db7e3bb392699b81dde30554796360b7ba7c025e4791
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL es2-1.1.3-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 5.9 MB
Tags CPython 3.11 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
5a3037140ee1343b8eb45a448f07b59bf66d7ddd2b1d7d76d05c1b84b9ed0712
BLAKE2b-256 checksum
How to use checksums
1a711e690f45c9fdd5eb60a472de171fed7b07bb38319e46a520223f6492056e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp311-cp311-macosx_11_0_arm64.whl

Download URL es2-1.1.3-cp311-cp311-macosx_11_0_arm64.whl
Size 3.6 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8fa4530a27eb6cdad426d6162ff5a3574150b0cefedf57be4d3cbe5b0e54902b
BLAKE2b-256 checksum
How to use checksums
7acdb397278a79a06b2e46563e908dcd56e0263f33306482bf2268174cd19bb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL es2-1.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.3 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
490c79dfca03e7e8a0127bf9f07b4a517b106e8145f4388eddb381da7d88549a
BLAKE2b-256 checksum
How to use checksums
18859e2c88dec03c0d37983a35535e13b38b39d592365ea31261e6d97f896bfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL es2-1.1.3-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 5.9 MB
Tags CPython 3.10 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
0585f25386120c85ca16d8eb3b4dd6757a10354ebab5e192861f40f124cf24e8
BLAKE2b-256 checksum
How to use checksums
ad4c37898f700e9b9aacc3a644d3365e6fae5c6cb7faa27ce1f106614061356d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp310-cp310-macosx_11_0_arm64.whl

Download URL es2-1.1.3-cp310-cp310-macosx_11_0_arm64.whl
Size 3.6 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
27f0ee874bc77c06963b8ce99a63c1ab9ae2a63282b64785784e066b70465116
BLAKE2b-256 checksum
How to use checksums
ddcf141a5064b42d86ced02c4a2bca5a1dba26cdd11b0a04af80a205f78102d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL es2-1.1.3-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.3 MB
Tags CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
dd119c1f48fbd4b4d156aa2e19e9d45e653c5ca7156bfdc2520e6cdbb4fa9935
BLAKE2b-256 checksum
How to use checksums
5e880becb1c5a5a8a829543b19d9ff433f0196d01346a7e67caba06173c8cab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL es2-1.1.3-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 5.9 MB
Tags CPython 3.9 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
d0bbf710c077f1e61ceebc75e9f21693e2218dd588e359425b2cc44875d72429
BLAKE2b-256 checksum
How to use checksums
2872ec8f9652bebf0b9bae09221248562b2e490fe01fc0697f23cf2f203cc802
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / es2-1.1.3-cp39-cp39-macosx_11_0_arm64.whl

Download URL es2-1.1.3-cp39-cp39-macosx_11_0_arm64.whl
Size 3.6 MB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7655275d0f96adce00fabad210e0b124a5d4c0f4d636a5b23928b69b7388c23a
BLAKE2b-256 checksum
How to use checksums
9b5fead7428f93f7f06b2db6de25639fdaf09e40a2974143eda016e6b1cc57dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page