Skip to main content

No project description provided

Project description

Rottnest : Data Lake Indices

You don't need ElasticSearch or some vector database to do full text search or vector search. Parquet + Rottnest is all you need. Rottnest is like Postgres indices for Parquet. Read more on what it can do for e.g. logs here.

Installation

Local installation: pip install rottnest.

Rottnest supports many different index types. Currently you need to install separate dependencies for each index type. I also don't yet support installation like pip install rottnest[bm25] because the dependencies are still being finalized. For the time being you can:

  • BM25: pip install duckdb openai if you want to rely on OpenAI embeddings for query expansion or if you want to use the FlagEmbedding library, pip install duckdb FlagEmbedding, it will be free but the quality will be lacking.
  • Phrase search: Nothing more needed.
  • Vector: pip install faiss (I am still working on properly supporting this, but most likely I will heavily rely on faiss to build a PQ-IVF index with SOAR).

How to use

Build indices on your Parquet files, merge them, and query them. Very simple. Let's walk through a very simple example, in demo.py. It builds a BM25 index on two Parquet files, merges the indices, and searches the merged index for records related to cell phones. The code is here:

import rottnest
rottnest.index_file_bm25("example_data/0.parquet", "body", "index0")
rottnest.index_file_bm25("example_data/1.parquet", "body", "index1")
rottnest.merge_index_bm25("merged_index", ["index0", "index1"])
result = rottnest.search_index_bm25(["merged_index"], "cell phones", K = 10)

This code will still work if the Parquet files are in fact on object storage. You can copy the data files to an S3 bucket, say s3://example_data/. Then the following code will work:

import rottnest
rottnest.index_file_bm25("s3://example_data/0.parquet", "body", "index0")
rottnest.index_file_bm25("s3://example_data/1.parquet", "body", "index1")
rottnest.merge_index_bm25("merged_index", ["index0", "index1"])
result = rottnest.search_index_bm25(["merged_index"], "cell phones", K = 10)

The indices themselves can also be on object storage.

Rottnest client will use the index to search against the Parquet files on S3 directly. Rottnest has its own Parquet reader that makes this very efficient.

If you are using S3-compatible file systems, like Ceph, MinIO, Alibaba or Volcano Cloud that might require virtual host style and different endpoint URL, you should set the following environment variables:

export AWS_ENDPOINT_URL=https://tos-s3-cn-beijing.volces.com
export AWS_VIRTUAL_HOST_STYLE=true

Rottnest not only supports BM25 indices but also other indices, like regex and vector searches. More documentation will be forthcoming.

Phrase Matches

Unlike BM25 which works on single terms, you can also build exact substring match indices which rely on the FM-index (for the moment). This is based on exact match. We are working on a Kmer-hash based method with minimizers to reduce the storage size. The code is here:

import rottnest
rottnest.index_file_substring("example_data/0.parquet", "body", "index0")
rottnest.index_file_substring("example_data/1.parquet", "body", "index1")
rottnest.merge_index_substring("merged_index", ["index0", "index1"])
result = rottnest.search_index_substring(["merged_index"], "cell phones", K = 10)

Vector Approximate Nearest Neighbor

Serverless Search Engine Architecture

Architecture

Rottnest can be used to build a serverless search engine. The client will use the index to search against the Parquet files on S3 directly, or Parquet files hosted by somebody else, like Huggingface. More documentation will be forthcoming. The (simplest possible) searcher Lambda code can be found in lambda/ directory.

Development

Build Python wheel

maturin develop --features "py,opendal"

or

maturin develop --features "py,aws_sdk"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

rottnest-1.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.8 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

rottnest-1.4.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (15.6 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

rottnest-1.4.0-cp38-abi3-macosx_11_0_arm64.whl (10.7 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

File details

Details for the file rottnest-1.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rottnest-1.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 78536c053ee0f8952278d221b96aabad168b5c06b7a602258647c3a31af2f342
MD5 28ba0aaf13db0a009aa8919a233de02f
BLAKE2b-256 359330af73bea03942ee20bfbcfa4bef37cce1601c2af5fc167b1cb79904a6dd

See more details on using hashes here.

File details

Details for the file rottnest-1.4.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rottnest-1.4.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4c970e163b24418e08d6ab6cee69dcd01457f36b38b142c3c77c238251975369
MD5 c6016fe707a5ba1ff15e99d6d8a5b7c0
BLAKE2b-256 9660e9548270c169d83bff59f4a0c55220e1e39c981bdaea8efd38049a138be6

See more details on using hashes here.

File details

Details for the file rottnest-1.4.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rottnest-1.4.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ec33acacb9855f04f11a28ee4a7da5f4f988257b0d27dfb35391a353754da1a
MD5 64d7ea0741fe609083f6ce213049770f
BLAKE2b-256 0bc5689844f01c9f45d14200154e4bf8219e673bd2fda2c252e80d64cd008373

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page