Skip to content

Latest commit

 

History

History
98 lines (75 loc) · 2.37 KB

percolate.md

File metadata and controls

98 lines (75 loc) · 2.37 KB

Working with Percolate indexes

Percolate operations

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:

Inserting stored query

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);

Percolate search

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);

List stored queries

For listing stored queries, the index parameter is required.

index is mandatory.

$params = [
    'index' => 'test_pq',
    'body' => [
    ]
];
$response = $client->pq()->search($params);

Delete stored queries

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);