Java v6 - Beta release
The Java v6 client is available as a beta release.
This means that the library is still under development and may change in future releases, including potential breaking changes. We do not recommend using this client library in production environments at this time.
The latest Java v6 client is version v6.0.0-M2.
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.
Installationβ
<dependency>
<groupId>io.weaviate</groupId>
<artifactId>client6</artifactId>
<version>6.0.0-M2</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.
<dependency>
<groupId>io.weaviate</groupId>
<artifactId>client6</artifactId>
<version>6.0.0-M2</version>
<classifier>all</classifier>
</dependency>
Requirements: Weaviate version compatibility & gRPC
Weaviate version compatibilityβ
The v6 Java client requires Weaviate 1.33.0 or higher. 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:
ports:
- 8080:8080
- 50051:50051
Get startedβ
If you haven't yet, we recommend going through the Quickstart tutorial first to get the most out of this section.
Get started with Weaviate using this Java example. The code walks you through these key steps:
- Connect to Weaviate: Establish a connection to a local (or Cloud) Weaviate instance.
- Create a collection: Define the data schema for a
Questioncollection, using an Ollama model to vectorize the data. - Import data: Fetch sample Jeopardy questions and use Weaviate's batch import for efficient ingestion and automatic vector embedding generation.
- Search/query the database: Execute a vector search to find questions semantically similar to the query
biology.
// Connect to a local Weaviate instance
client = WeaviateClient.connectToLocal();
if (client.collections.exists(collectionName)) {
client.collections.delete(collectionName);
}
// Create a collection with
client.collections.create(
collectionName,
col -> col.properties(Property.text("answer"),
Property.text("question"),
Property.text("category"))
.vectorConfig(VectorConfig.text2vecTransformers()) // Configure the Contextionary 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 insertion
List<Map<String, Object>> questionsToInsert = new ArrayList<>();
// Populate the list with the data
for (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 objects
InsertManyResponse insertResponse = questions.data.insertMany(questionsToInsert.toArray(new Map[0]));
// Check for errors
if (!insertResponse.errors().isEmpty()) {
System.err.println("Errors during insertMany: " + insertResponse.errors());
}
// Perform a vector similarity search
var queryResponse = questions.query.nearText("biology", q -> q.limit(2));
for (var obj : queryResponse.objects()) {
System.out.println(obj.properties());
}
For more code examples, check out the How-to manuals & Guides section.
Asynchronous usageβ
Coming soon
Releasesβ
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 the latest five Weaviate Database versions and corresponding client library versions.
| Weaviate Database (GitHub) | First release date | Python (GitHub) | TypeScript/ JavaScript (GitHub) | Go (GitHub) | Java (GitHub) |
|---|---|---|---|---|---|
| 1.33.x | 2025-09-25 | 4.17.x | 3.9.x | 5.5.x | 5.5.x |
| 1.32.x | 2025-07-14 | 4.16.x | 3.8.x | 5.3.x | 5.4.x |
| 1.31.x | 2025-05-30 | 4.15.x | 3.6.x | 5.2.x | 5.3.x |
| 1.30.x | 2025-04-03 | 4.12.x | 3.5.x | 5.1.x | 5.2.x |
| 1.29.x | 2025-02-17 | 4.11.x | 3.4.x | 5.0.x | 5.1.x |
Older releases
| Weaviate Database (GitHub) | First release date | Python (GitHub) | TypeScript/ JavaScript (GitHub) | Go (GitHub) | Java (GitHub) |
|---|---|---|---|---|---|
| 1.28.x | 2024-12-11 | 4.10.x | 3.3.x | 4.16.x | 5.0.x |
| 1.27.x | 2024-10-16 | 4.9.x | 3.2.x | 4.16.x | 5.0.x 4.9.x |
| 1.26.x | 2024-07-22 | 4.7.x | 3.1.x | 4.15.x | 4.8.x |
| 1.25.x | 2024-05-10 | 4.6.x | 2.1.x | 4.13.x | 4.6.x |
| 1.24.x | 2024-02-27 | 4.5.x | 2.0.x | 4.10.x | 4.4.x |
| 1.23.x | 2023-12-18 | 3.26.x | 1.5.x | 4.10.x | 4.4.x |
| 1.22.x | 2023-10-27 | 3.25.x | 1.5.x | 4.10.x | 4.3.x |
| 1.21.x | 2023-08-17 | 3.22.x | 1.4.x | 4.9.x | 4.2.x |
| 1.20.x | 2023-07-06 | 3.22.x | 1.1.x | 4.7.x | 4.2.x |
| 1.19.x | 2023-05-04 | 3.17.x | 1.1.x1 | 4.7.x | 4.0.x |
| 1.18.x | 2023-03-07 | 3.13.x | 2.14.x | 4.6.x | 3.6.x |
| 1.17.x | 2022-12-20 | 3.9.x | 2.14.x | 4.5.x | 3.5.x |
| 1.16.x | 2022-10-31 | 3.8.x | 2.13.x | 4.4.x | 3.4.x |
| 1.15.x | 2022-09-07 | 3.6.x | 2.12.x | 4.3.x | 3.3.x |
| 1.14.x | 2022-07-07 | 3.6.x | 2.11.x | 4.2.x | 3.2.x |
| 1.13.x | 2022-05-03 | 3.4.x | 2.9.x | 4.0.x | 2.4.x |
| 1.12.x | 2022-04-05 | 3.4.x | 2.8.x | 3.0.x | 2.3.x |
| 1.11.x | 2022-03-14 | 3.2.x | 2.7.x | 2.6.x | 2.3.x |
| 1.10.x | 2022-01-27 | 3.1.x | 2.5.x | 2.4.x | 2.1.x |
| 1.9.x | 2021-12-10 | 3.1.x | 2.4.x | 2.4.x | 2.1.x |
| 1.8.x | 2021-11-30 | 3.1.x | 2.4.x | 2.3.x | 1.1.x |
| 1.7.x | 2021-09-01 | 3.1.x | 2.4.x | 2.3.x | 1.1.x |
| 1.6.x | 2021-08-11 | 2.4.x | 2.3.x | 2.2.x | 1.0.x |
| 1.5.x | 2021-07-13 | 2.2.x | 2.1.x | 2.1.x | 1.0.x |
| 1.4.x | 2021-06-09 | 2.2.x | 2.1.x | 2.1.x | 1.0.x |
| 1.3.x | 2021-04-23 | 2.2.x | 2.1.x | 2.1.x | 1.0.x |
| 1.2.x | 2021-03-15 | 2.2.x | 2.0.x | 1.1.x | - |
| 1.1.x | 2021-02-10 | 2.1.x | - | - | - |
| 1.0.x | 2021-01-14 | 2.0.x | - | - | - |
TypeScript client changeβ
The TypeScript client replaced the JavaScript client on 2023-03-17.
Code examples & further resourcesβ
Usage information for various operations and features can be found throughout the Weaviate documentation.
Configure compression, backups, authentication, authorization, data replication and more.
Manage collections (CRUD), configure vectorizers and index parameters, set up multi-tenancy, and perform migrations.
Adding new objects, fetching existing ones, modifying them, and removing them from collections.
From basic vector and hybrid searches to specialized image queries and performing data aggregations.
The Weaviate API reference pages for search and REST may also be useful starting points.
Questions and feedbackβ
If you have any questions or feedback, let us know in the user forum.
