Skip to main content
Weaviate Docs (migrated from docs.weaviate.io) Docs

Search documentation

Type to search this documentation.

On this pageOverview

Java

This page broadly covers the Weaviate Java client (v6 beta release). For usage information not specific to the Java client, such as code examples, see the relevant pages in the How-to manuals & Guides.

xml
<dependency>
    <groupId>io.weaviate</groupId>
    <artifactId>client6</artifactId>
    <version>6.2.0</version>
</dependency>
Uber JAR🫙

If you're building an uber-JAR with something like maven-assembly-plugin, use a shaded version with classifier all. This ensures that all dynamically-loaded dependencies of io.grpc are resolved correctly.

xml
<dependency>
    <groupId>io.weaviate</groupId>
    <artifactId>client6</artifactId>
    <version>6.2.0</version>
    <classifier>all</classifier>
</dependency>
Requirements: Weaviate version compatibility & gRPC

Weaviate version compatibility

The v6 Java client requires Weaviate v1.32.0 and later. Generally, we encourage you to use the latest version of the Java client and the Weaviate Database.

gRPC

The v6 client uses remote procedure calls (RPCs) under-the-hood. Accordingly, a port for gRPC must be open to your Weaviate server.

docker-compose.yml example

If you are running Weaviate with Docker, you can map the default port (50051) by adding the following to your docker-compose.yml file:

YAML
ports:
  - 8080:8080
  - 50051:50051

Get started with Weaviate using this Java example. The code walks you through these key steps:

  1. Connect to Weaviate: Establish a connection to a local (or Cloud) Weaviate instance.
  2. Create a collection: Define the data schema for a Question collection, using an Ollama model to vectorize the data.
  3. Import data: Fetch sample Jeopardy questions and use Weaviate's batch import for efficient ingestion and automatic vector embedding generation.
  4. Search/query the database: Execute a vector search to find questions semantically similar to the query biology.
Java
// Connect to a local Weaviate instanceclient = WeaviateClient.connectToLocal();if (client.collections.exists(collectionName)) {  client.collections.delete(collectionName);}// Create a collection withclient.collections.create(    collectionName,    col -> col.properties(Property.text("answer"),        Property.text("question"),        Property.text("category"))        .vectorConfig(VectorConfig.text2vecOllama(v -> v            // If using Docker you might need: http://host.docker.internal:11434            .apiEndpoint("http://ollama:11434")            .model("nomic-embed-text") // The model to use        )) // Configure the Ollama embedding model);CollectionHandle<Map<String, Object>> questions = client.collections.use(collectionName);HttpClient httpClient = HttpClient.newHttpClient();HttpRequest request = HttpRequest.newBuilder()    .uri(URI        .create("https://raw.githubusercontent.com/weaviate-tutorials/quickstart/main/data/jeopardy_tiny.json"))    .build();HttpResponse<String> responseHttp = httpClient.send(request, HttpResponse.BodyHandlers.ofString());String responseBody = responseHttp.body();ObjectMapper objectMapper = new ObjectMapper();List<Map<String, String>> data = objectMapper.readValue(responseBody, new TypeReference<>() {});// Create a list to hold the objects for insertionList<Map<String, Object>> questionsToInsert = new ArrayList<>();// Populate the list with the datafor (Map<String, String> d : data) {  Map<String, Object> properties = new HashMap<>();  properties.put("answer", d.get("Answer"));  properties.put("question", d.get("Question"));  properties.put("category", d.get("Category"));  questionsToInsert.add(properties);}// Call insertMany with the list of objectsInsertManyResponse insertResponse = questions.data.insertMany(questionsToInsert.toArray(new Map[0]));// Check for errorsif (!insertResponse.errors().isEmpty()) {  System.err.println("Errors during insertMany: " + insertResponse.errors());}

For more code examples, check out the How-to manuals & Guides section.

Coming soon

Go to the GitHub releases page to see the history of the Java client library releases and change logs.

Click here for a table of Weaviate and corresponding client versions

This table lists recent Weaviate Database versions and corresponding client library versions.

Weaviate Database
([GitHub][cWeaviate])
First
release date
Python
([GitHub][cPython])
TypeScript/
JavaScript
([GitHub][cTypeScript])
Go
([GitHub][cGo])
Java
([GitHub][cJava])
C#
([GitHub][cCSharp])
1.39.x2026-08-044.23.x--6.3.11.2.0
1.38.x2026-06-054.22.x3.14.x-6.3.01.2.0
1.37.x2026-04-164.21.x3.13.x5.7.36.2.01.1.1
1.36.x2026-02-244.20.x3.12.x5.7.x6.1.01.0.1
1.35.x2025-12-174.19.x3.11.x5.6.x6.0.01.0.0
Older releases
Weaviate Database
(GitHub)
First
release date
Python
(GitHub)
TypeScript/
JavaScript
(GitHub)
Go
(GitHub)
Java
(GitHub)
1.34.x2025-11-054.18.x3.10.x5.6.x6.0.0
1.33.x2025-09-254.17.x3.9.x5.5.x5.5.x
1.32.x2025-07-144.16.x3.8.x5.3.x5.4.x
1.31.x2025-05-304.15.x3.6.x5.2.x5.3.x
1.30.x2025-04-034.12.x3.5.x5.1.x5.2.x
1.29.x2025-02-174.11.x3.4.x5.0.x5.1.x
1.28.x2024-12-114.10.x3.3.x4.16.x5.0.x
1.27.x2024-10-164.9.x3.2.x4.16.x5.0.x
4.9.x
1.26.x2024-07-224.7.x3.1.x4.15.x4.8.x
1.25.x2024-05-104.6.x2.1.x4.13.x4.6.x
1.24.x2024-02-274.5.x2.0.x4.10.x4.4.x
1.23.x2023-12-183.26.x1.5.x4.10.x4.4.x
1.22.x2023-10-273.25.x1.5.x4.10.x4.3.x
1.21.x2023-08-173.22.x1.4.x4.9.x4.2.x
1.20.x2023-07-063.22.x1.1.x4.7.x4.2.x
1.19.x2023-05-043.17.x1.1.x14.7.x4.0.x
1.18.x2023-03-073.13.x2.14.x4.6.x3.6.x
1.17.x2022-12-203.9.x2.14.x4.5.x3.5.x
1.16.x2022-10-313.8.x2.13.x4.4.x3.4.x
1.15.x2022-09-073.6.x2.12.x4.3.x3.3.x
1.14.x2022-07-073.6.x2.11.x4.2.x3.2.x
1.13.x2022-05-033.4.x2.9.x4.0.x2.4.x
1.12.x2022-04-053.4.x2.8.x3.0.x2.3.x
1.11.x2022-03-143.2.x2.7.x2.6.x2.3.x
1.10.x2022-01-273.1.x2.5.x2.4.x2.1.x
1.9.x2021-12-103.1.x2.4.x2.4.x2.1.x
1.8.x2021-11-303.1.x2.4.x2.3.x1.1.x
1.7.x2021-09-013.1.x2.4.x2.3.x1.1.x
1.6.x2021-08-112.4.x2.3.x2.2.x1.0.x
1.5.x2021-07-132.2.x2.1.x2.1.x1.0.x
1.4.x2021-06-092.2.x2.1.x2.1.x1.0.x
1.3.x2021-04-232.2.x2.1.x2.1.x1.0.x
1.2.x2021-03-152.2.x2.0.x1.1.x-
1.1.x2021-02-102.1.x---
1.0.x2021-01-142.0.x---

TypeScript client change

The TypeScript client replaced the JavaScript client on 2023-03-17.

The Weaviate Java client v5 has been deprecated and should no longer be used. If you need documentation for the v5 client, see the documentation archive.

Usage information for various operations and features can be found throughout the Weaviate documentation.

The Weaviate API reference pages for search and REST may also be useful starting points.

Have a question or feedback? Here's how to reach us.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu