{"id":35142897,"url":"https://github.com/grain-team/milvex","last_synced_at":"2026-06-06T00:31:23.719Z","repository":{"id":327377650,"uuid":"1108545782","full_name":"grain-team/milvex","owner":"grain-team","description":"An Elixir Client for Milvus","archived":false,"fork":false,"pushed_at":"2026-03-23T18:22:03.000Z","size":431,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-24T08:38:24.641Z","etag":null,"topics":["elixir","milvus","vector-search"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grain-team.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-02T15:38:22.000Z","updated_at":"2026-03-23T18:21:53.000Z","dependencies_parsed_at":"2026-02-10T12:04:47.280Z","dependency_job_id":null,"html_url":"https://github.com/grain-team/milvex","commit_stats":null,"previous_names":["ycastorium/milvex"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/grain-team/milvex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grain-team%2Fmilvex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grain-team%2Fmilvex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grain-team%2Fmilvex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grain-team%2Fmilvex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grain-team","download_url":"https://codeload.github.com/grain-team/milvex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grain-team%2Fmilvex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","milvus","vector-search"],"created_at":"2025-12-28T12:24:45.952Z","updated_at":"2026-04-01T17:19:24.919Z","avatar_url":"https://github.com/grain-team.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Milvex\n\nAn Elixir client for [Milvus](https://milvus.io/), the open-source vector database built for scalable similarity search.\n\n## Features\n\n- Full gRPC client with automatic reconnection and health monitoring\n- Fluent builders for schemas, indexes, and data\n\n## Installation\n\nAdd `milvex` to your dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:milvex, \"~\u003e 0.4.1\"}\n  ]\nend\n```\n\n## Quick Start\n\n### Connect to Milvus\n\n```elixir\n# Start a connection\n{:ok, conn} = Milvex.Connection.start_link(host: \"localhost\", port: 19530)\n\n# Or with a named connection\n{:ok, _} = Milvex.Connection.start_link([host: \"localhost\"], name: :milvus)\n```\n\n### Start Under a Supervisor\n\n```elixir\ndefmodule MyApp.Application do\n  use Application\n\n  def start(_type, _args) do\n    children = [\n      {Milvex.Connection, [host: \"localhost\", port: 19530, name: MyApp.Milvus]}\n    ]\n\n    opts = [strategy: :one_for_one, name: MyApp.Supervisor]\n    Supervisor.start_link(children, opts)\n  end\nend\n```\n\nThen use the named connection throughout your app:\n\n```elixir\nMilvex.search(MyApp.Milvus, \"movies\", vectors, vector_field: \"embedding\")\n```\n\n### Define a Schema\n\n```elixir\nalias Milvex.Schema\nalias Milvex.Schema.Field\n\nschema = Schema.build!(\n  name: \"movies\",\n  fields: [\n    Field.primary_key(\"id\", :int64, auto_id: true),\n    Field.varchar(\"title\", 512),\n    Field.vector(\"embedding\", 128)\n  ],\n  enable_dynamic_field: true\n)\n```\n\n### Create Collection and Index\n\n```elixir\nalias Milvex.Index\n\n# Create collection\n:ok = Milvex.create_collection(conn, \"movies\", schema)\n\n# Create an HNSW index\nindex = Index.hnsw(\"embedding\", :cosine, m: 16, ef_construction: 256)\n:ok = Milvex.create_index(conn, \"movies\", index)\n\n# Load collection into memory for search\n:ok = Milvex.load_collection(conn, \"movies\")\n```\n\n### Insert Data\n\n```elixir\n# Insert with auto-fetched schema\n{:ok, result} = Milvex.insert(conn, \"movies\", [\n  %{title: \"The Matrix\", embedding: vector_128d()},\n  %{title: \"Inception\", embedding: vector_128d()}\n])\n\n# result.ids contains the auto-generated IDs\n```\n\n### Search\n\n```elixir\nquery_vector = [0.1, 0.2, ...]  # 128-dimensional vector\n\n{:ok, results} = Milvex.search(conn, \"movies\", [query_vector],\n  vector_field: \"embedding\",\n  top_k: 10,\n  output_fields: [\"title\"],\n  filter: \"title like \\\"The%\\\"\"\n)\n\n# Access results\nfor hit \u003c- results.hits do\n  IO.puts(\"#{hit.id}: #{hit.fields[\"title\"]} (score: #{hit.score})\")\nend\n```\n\n### Query by Expression\n\n```elixir\n{:ok, results} = Milvex.query(conn, \"movies\", \"id \u003e 0\",\n  output_fields: [\"id\", \"title\"],\n  limit: 100\n)\n```\n\n## Connection Configuration\n\n```elixir\nMilvex.Connection.start_link(\n  host: \"localhost\",        # Milvus server hostname\n  port: 19530,              # gRPC port (default: 19530, or 443 for SSL)\n  database: \"default\",      # Database name\n  user: \"root\",             # Username (optional)\n  password: \"milvus\",       # Password (optional)\n  token: \"api_token\",       # API token (alternative to user/password)\n  ssl: true,                # Enable SSL/TLS\n  ssl_options: [],          # SSL options for transport\n  timeout: 30_000           # Connection timeout in ms\n)\n\n# Or use a URI\n{:ok, config} = Milvex.Config.parse_uri(\"https://user:pass@milvus.example.com:443/mydb\")\n{:ok, conn} = Milvex.Connection.start_link(config)\n```\n\n## Index Types\n\n```elixir\n# HNSW - best for high recall with good performance\nIndex.hnsw(\"field\", :cosine, m: 16, ef_construction: 256)\n\n# IVF_FLAT - good balance for medium datasets\nIndex.ivf_flat(\"field\", :l2, nlist: 1024)\n\n# AUTOINDEX - let Milvus choose optimal settings\nIndex.autoindex(\"field\", :ip)\n\n# IVF_PQ - memory efficient for large datasets\nIndex.ivf_pq(\"field\", :l2, nlist: 1024, m: 8, nbits: 8)\n\n# DiskANN - for datasets that don't fit in memory\nIndex.diskann(\"field\", :l2)\n```\n\nMetric types: `:l2`, `:ip`, `:cosine`, `:hamming`, `:jaccard`\n\n## Partitions\n\n```elixir\n# Create partition\n:ok = Milvex.create_partition(conn, \"movies\", \"movies_2024\")\n\n# Insert into partition\n{:ok, _} = Milvex.insert(conn, \"movies\", data, partition_name: \"movies_2024\")\n\n# Search specific partitions\n{:ok, _} = Milvex.search(conn, \"movies\", vectors,\n  vector_field: \"embedding\",\n  partition_names: [\"movies_2024\", \"movies_2023\"]\n)\n\n# Load/release partitions\n:ok = Milvex.load_partitions(conn, \"movies\", [\"movies_2024\"])\n:ok = Milvex.release_partitions(conn, \"movies\", [\"movies_2024\"])\n```\n\n## Error Handling\n\nAll functions return `{:ok, result}` or `{:error, error}`. Bang variants (e.g., `insert!`) raise on error.\n\n```elixir\ncase Milvex.search(conn, \"movies\", vectors, vector_field: \"embedding\") do\n  {:ok, results} -\u003e process_results(results)\n  {:error, %Milvex.Errors.Connection{}} -\u003e handle_connection_error()\n  {:error, %Milvex.Errors.Grpc{code: code}} -\u003e handle_grpc_error(code)\n  {:error, %Milvex.Errors.Invalid{field: field}} -\u003e handle_validation_error(field)\nend\n```\n\n## Development\n\n### Running Tests\n\n```bash\n# Unit tests\nmix test\n\n# Integration tests (requires Docker)\nmix test.integration\n```\n\n### Regenerating Proto Files\n\nFrom the `milvus-proto/proto` directory:\n\n```bash\nprotoc --elixir_out=one_file_per_module=true,plugins=grpc:../../lib \\\n       --elixir_opt=package_prefix=milvex \\\n       --elixir_opt=include_docs=true *.proto\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrain-team%2Fmilvex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrain-team%2Fmilvex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrain-team%2Fmilvex/lists"}