send #
Sends a query to the Kuzzle API.
Signature #
virtual kuzzleio::kuzzle_response* send(
const std::string& query,
kuzzleio::query_options *options,
const std::string& request_id) = 0;
Arguments #
Argument | Type | Description |
---|---|---|
query | const std::string& | API request |
options | kuzzleio::query_options* | Additional query options |
request_id | const std::string& | Optional request identifier |
request #
Properties required for the Kuzzle API can be set in the kuzzle_request struct. The following properties are the most common.
Property | Type | Description | Required |
---|---|---|---|
controller | const char* | Controller name | yes |
action | const char* | Action name | yes |
body | const char* | JSON string representing body for this action | no |
index | const char* | Index name for this action | no |
collection | const char* | Collection name for this action | no |
id | const char* | ID for this action | no |
volatiles | const char* | JSON string representing additional information to send to Kuzzle | no |
options #
Additionnal query options. The following properties are the most common:
Property | Type (default) | Description |
---|---|---|
queuable | bool ( true ) | If true, queues the request during downtime, until connected to Kuzzle again |
refresh | const std::string& ( "" ) | If set to wait_for , waits for the change to be reflected for search (up to 1s) |
from | int ( 0 ) | Offset of the first document to fetch |
size | int ( 10 ) | Maximum number of documents to retrieve per page |
scroll | const std::string& ( "" ) | When set, gets a forward-only cursor having its ttl set to the given value (ie 30s ; cf elasticsearch time limits) |
request_id #
User-defined request identifier.
Kuzzle does not guarantee that responses are sent back in the same order than queries are made: use that field to link responses to their query of origin.
Return #
A kuzzle_response
containing the Kuzzle API response. See the API Documentation. The following properties are the most common:
Property | Type | Description |
---|---|---|
request_id | const char * | Request unique ID |
result | const char * | JSON string representing Kuzzle API result |
error | const char * | Error message |
status | int | Request status (eg: 200, 403, etc.) |