Weaviate: define a schema and perform a hybrid search

domain: weaviate.io/developers/weaviate · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Start a Weaviate instance via Docker Compose or connect to a Weaviate Cloud cluster; instantiate the Python client with weaviate.connect_to_local() or weaviate.connect_to_weaviate_cloud().
  2. Create a collection (formerly class) with client.collections.create(name='NAME', properties=[Property(name='text', data_type=DataType.TEXT)], vectorizer_config=Configure.Vectorizer.text2vec_openai()) or another vectorizer.
  3. Import objects using collection.data.insert_many([{'text': 'some content', ...}]) to batch-insert documents; Weaviate vectorizes them automatically if a vectorizer is configured.
  4. Perform a hybrid search combining keyword (BM25) and vector similarity: collection.query.hybrid(query='search terms', alpha=0.5, limit=10) where alpha controls the balance between keyword and vector results.
  5. Access each result object's properties and metadata (including score) from the returned objects list.
  6. Add filters with the Filter helper class to restrict results by property values before running the hybrid query.

Known gotchas

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans