-
Administrative operations
Each request array can include one of the following:
- body - the API endpoint POST payload
- table/cluster - table/cluster name
- id - document id
- query - endpoint parameters
Some parameters are mandatory, depending on the request.
No validity check is performed on the body payload before sending the request.
Responses are returned as arrays reflecting the response object received from the API endpoint.
For a complete reference of payload and response, see Manticore's Search API.
Regular searches use the table and query parameters. Conversational searches instead use a top-level chat object; see the low-level client search documentation.
A simple search example:
$params = [
'body' => [
'table' => 'movies',
'query' => [
'match_phrase' => [
'movie_title' => 'star trek nemesis',
]
]
]
];
$response = $client->search($params);
For a complete reference of payload and response, see Manticore's Insert API.
body requires the presence of the table, id, and doc parameters.
$doc = [
'body' => [
'table' => 'testrt',
'id' => 3,
'doc' => [
'gid' => 10,
'title' => 'some title here',
'content' => 'some content here',
'newfield' => 'this is a new field',
'unreal' => 'engine',
'real' => 8.99,
'j' => [
'hello' => ['testing', 'json', 'here'],
'numbers' => [1, 2, 3],
'value' => 10.0
]
]
]
];
$response = $client->insert($doc);
For a complete reference of payload and response, see Manticore's Replace API.
body requires the presence of the table, id, and doc parameters.
$doc = [
'body' => [
'table' => 'testrt',
'id' => 3,
'doc' => [
'gid' => 10,
'content' => 'updated content here',
]
]
];
$response = $client->replace($doc);
For a complete reference of payload and response, see Manticore's Update API.
body requires the presence of the table, id, and doc parameters.
$doc = [
'body' => [
'table' => 'testrt',
'id' => 3,
'doc' => [
'gid' => 20,
]
]
];
$response = $client->update($doc);
For a complete reference of payload and response, see Manticore's Delete API.
body requires the presence of both table and id parameters.
$doc = [
'body' => [
'table' => 'testrt',
'id' => 3
]
];
$response = $client->delete($doc);
For a complete reference of payload and response, see Manticore's Bulk API
Bulk allows sending multiple data manipulation operations (inserts, replaces, updates, or deletes) in one request.
$doc = [
'body' => [
['insert' => [
'table' => 'testrt',
'id' => 34,
'doc' => [
'gid' => 1,
'title' => 'a new added document',
]
]],
['update' => [
'table' => 'testrt',
'id' => 56,
'doc' => [
'gid' => 4,
]
]],
['delete' => [
'table' => 'testrt',
'id' => 100
]]
]
];
$response = $client->bulk($doc);
For a complete reference of payload and response, see Manticore's Autocomplete manual.
The request requires query and table defined as required parameters.
$request = [
'body' => [
'query' => 'hello wo',
'table' => 'testrt',
],
];
$response = $client->autocomplete($request);