-
Administrative operations
Each request array can include one of the following:
- body - the API endpoint POST payload
- index/cluster - index/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.
body
requires the presence of the index
and query
parameters.
A simple search example:
$params = [
'body' => [
'index' => '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 index
, id
, and doc
parameters.
$doc = [
'body' => [
'index' => '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 index
, id
, and doc
parameters.
$doc = [
'body' => [
'index' => '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 index
, id
, and doc
parameters.
$doc = [
'body' => [
'index' => '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 index
and id
parameters.
$doc = [
'body' => [
'index' => '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' => [
'index' => 'testrt',
'id' => 34,
'doc' => [
'gid' => 1,
'title' => 'a new added document',
]
]],
['update' => [
'index' => 'testrt',
'id' => 56,
'doc' => [
'gid' => 4,
]
]],
['delete' => [
'index' => '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);