A Java native client for weaviate.
In order to get start using the java client one needs to add it's dependency:
<dependency>
<groupId>technology.semi.weaviate</groupId>
<artifactId>client</artifactId>
<version>3.5.0</version>
</dependency>
Here's a simple code to start up working with Java client:
-
Add dependency to your java project.
-
Connect to Weaviate on
localhost:8080
and fetch meta information
import technology.semi.weaviate.client.Config;
import technology.semi.weaviate.client.WeaviateClient;
import technology.semi.weaviate.client.base.Result;
import technology.semi.weaviate.client.v1.misc.model.Meta;
public class App {
public static void main(String[] args) {
Config config = new Config("http", "localhost:8080");
WeaviateClient client = new WeaviateClient(config);
Result<Meta> meta = client.misc().metaGetter().run();
if (meta.hasErrors()) {
System.out.printf("Error: %s\n", meta.getError().getMessages());
} else {
System.out.printf("meta.hostname: %s\n", meta.getResult().getHostname());
System.out.printf("meta.version: %s\n", meta.getResult().getVersion());
System.out.printf("meta.modules: %s\n", meta.getResult().getModules());
}
}
}
Branch | Status |
---|---|
Main |