Java client for Pilosa high performance distributed index.
See: CHANGELOG
- JDK 7 and higher
- Maven 3 and higher
Add the following dependency in your pom.xml
:
<dependencies>
<dependency>
<groupId>com.pilosa</groupId>
<artifactId>pilosa-client</artifactId>
<version>1.3.1</version>
</dependency>
</dependencies>
Assuming Pilosa server is running at localhost:10101
(the default):
// Create the default client
PilosaClient client = PilosaClient.defaultClient();
// Retrieve the schema
Schema schema = client.readSchema();
// Create an Index object
Index myindex = schema.index("myindex");
// Create a Field object
Field myfield = myindex.field("myfield");
// make sure the index and field exists on the server
client.syncSchema(schema);
// Send a Set query. PilosaException is thrown if execution of the query fails.
client.query(myfield.set(5, 42));
// Send a Row query. PilosaException is thrown if execution of the query fails.
QueryResponse response = client.query(myfield.row(5));
// Get the result
QueryResult result = response.getResult();
// Act on the result
if (result != null) {
List<Long> columns = result.getRow().getColumns();
System.out.println("Got columns: " + columns);
}
// You can batch queries to improve throughput
response = client.query(
myindex.batchQuery(
myfield.row(5),
myfield.row(10)
)
);
for (Object r : response.getResults()) {
// Act on the result
}
See: Server Interaction
See: Importing Data
See: CONTRIBUTING
See: LICENSE