SDK
SDK Java v3.x
2

This SDK is deprecated. We recommend to use the Kuzzle SDK-JVM.
A migration guide is available here

query #

Base method used to send queries to Kuzzle, following the API Documentation.

This is a low-level method, exposed to allow advanced SDK users to bypass high-level methods.

Arguments #

public CompletableFuture<Response> query(
  final ConcurrentHashMap<String, Object> query)
      throws InternalException, NotConnectedException

ArgumentTypeDescription
query
ConcurrentHashMap<String, Object>
API request

query #

All properties necessary for the Kuzzle API can be added in the query object. The following properties are the most common.

PropertyTypeDescription
controller
String
Controller name (mandatory)
action
String
Action name (mandatory)
body
ConcurrentHashMap<String, Object>
Query body for this action
index
String
Index name for this action
collection
String
Collection name for this action
_id
String
id for this action
volatile
ConcurrentHashMap<String, Object>
Additional information to send to Kuzzle

Returns #

Returns a Response object which represents a raw Kuzzle API response. See the API Documentation.

Usage #

ConcurrentHashMap<String, Object> query = new ConcurrentHashMap<>();
query.put("controller", "document");
query.put("action", "create");
query.put("index", "nyc-open-data");
query.put("collection", "yellow-taxi");
query.put("_id", "my-custom-document-id");
query.put("refresh", "wait_for");
ConcurrentHashMap<String, Object> body = new ConcurrentHashMap<>();
body.put("trip_distance", 4.23);
body.put("passenger_count", 2);
query.put("body", body);
Response res = kuzzle.query(query).get();