How to add queries into percolator using elasticsearch-php

I am new to using elasticsearch-php. I was looking to work with percolator. I was able to map through - it was straight forward. But now i was stuck when was looking to find a way to add queries in percolator.

I failed to actually find any method in the same. If there are mechanism to do the same, please guide.

Hi @Amit_Shah,

I am not familiar with PHP but reading the PHP client docs on how to work with JSON objects and PHP clients docs on indexing documents, adding the example percolate query from the Elasticsearch docs, should work as follows:

$params = [
    'index' => 'my_index',
    'type' => 'query',
    'id' => '1',
    'body' => [
        'query' => [
            'match' => [
                 'message' => 'bonsai tree'
             ]
        ]
    ]
];

// Document will be indexed to my_index/query/1
$response = $client->index($params);

Daniel

Kool thanx Daniel,

I definitely will look into the same .. hope that it helps me sort things without writing custom CURL stuff..

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.