For the complete reference of payloads and responses, see Manticore's PQ API.
Operations with percolate indexes have their own namespace. The following methods are available:
For storing queries, the index
parameter is mandatory.
index
is mandatory.
Simple insertion with an auto-generated id:
$params = [
'index' => 'test_pq',
'body' => [
'query' => ['match'=>['subject'=>'test']],
'tags' => ['test1','test2']
]
];
$response = $client->pq()->doc($params);
Inserting with ID specified and refresh command:
$params = [
'index' => 'test_pq',
'id' =>101,
'query' => ['refresh' =>1],
'body' => [
'query' => ['match'=>['subject'=>'testsasa']],
'tags' => ['test1','test2']
]
];
$response = $client->pq()->doc($params);
For searching, the index
parameter is required.
index
is mandatory.
$params = [
'index' => 'pq',
'body' => [
'query' => [
'percolate' => [
'document' => [
'subject'=>'test',
'content' => 'some content',
'catid' =>5
]
]
]
]
];
$response = $client->pq()->search($params);
For listing stored queries, the index
parameter is required.
index
is mandatory.
$params = [
'index' => 'test_pq',
'body' => [
]
];
$response = $client->pq()->search($params);
For deleting stored queries, the index
parameter is required.
index
is mandatory.
$params = [
'index' => 'test_pq',
'body' => [
'id' => [5,6]
]
];
$response = $client->pq()->deleteByQuery($params);