5

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!

barbasa
  • 675
  • 4
  • 22
  • 1
    Yes, this is correct – DrTech Dec 04 '14 at 18:30
  • This should have probably been an email to the author of the module, your link lists his email address. You were more or less lucky he is here on Stack Overflow and had commented on your question. – Jiri Klouda Jan 20 '15 at 22:24
  • @JiriKlouda I have privately emailed the author and posted the question here as well, so it could be shared. Thanks anyway for pointing it out. – barbasa Jan 21 '15 at 09:18

1 Answers1

0

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

barbasa
  • 675
  • 4
  • 22