send #
Base method used to send queries to Kuzzle, following the API Documentation.
Signature #
kuzzleio::kuzzle_response* send(const std::string& query, kuzzleio::query_options *options, const std::string& request_id);
Arguments #
Argument | Type | Description |
---|---|---|
query | const std::string& | API request |
options | kuzzleio::query_options* | Additional query options |
request_id | const std::string& | the request_id of the request if you want to set one |
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* | Raw JSON result |
error | const char* | Error message |
status | int | Request status (eg: 200, 403, etc.) |