Perl module for Elastisearch Percolator

179 Views Asked by At

I'm trying to use the Elasticsearch Percolator with perl and I have found this cool module.

The Percolation methods are listed here

As far as I can tell they're just read methods, hence it is only possible to read the queries index and see if a query already exists, count the queries matched, etc.

Unless I'm missing something it is not possible to add queries via the Percolator interface, so what I did is use the normal method to create a document against the .percolator index as follow:

my $e = Search::Elasticsearch->new( nodes => 'localhost:9200' );

$e->create(
        index   => 'my_index',
        type    => '.percolator',
        id      => $max_idx,
        body    => {
            query => {
              match => {
                ...whatever the query is....
              },
            },
        },
    );

Is that the best way of adding a query to the percolator index via the perl module ?

Thanks!

1

There are 1 best solutions below

0
On BEST ANSWER

As per DrTech answer the code I posted looks to be the correct way of doing it.