Is there another mailing list I should be using, perhaps? I have still 
found no solution to this problem.

On Thursday, January 15, 2015 at 3:44:11 PM UTC-5, Andrew Walker wrote:
>
> I have a remote node that I am attempting to connect to that requires an 
> api key as a URL parameter in addition to the body in order to get it to 
> work.
>
> The code is as follows:
>
> #!/usr/bin/perl
> use v5.14;
> use warnings;
> use Search::Elasticsearch;
> use Data::Dumper;
>
> my $API_KEY='API_KEY';
>
> my $ES = Search::Elasticsearch->new(
>     cxn_pool => 'Static::NoPing',
>     nodes => [{
>         scheme => 'https',
>         host => 'service.host.com',
>         port => 443,
>         path => '/api/es/a_path',
>     }],
>     #send_get_body_as => 'POST',
>     trace_to => 'Stdout',
>     log_to => 'Stdout',
> );
>
> my $res = $ES->search(
>     params => {
>         api_key => $API_KEY,
>     },
>     body        => {
>         query       => {
>             bool => {
>                 must => {
>                     query_string => {
>                         default_field => "_all",
>                         query => "thisisasitethatdoesntexist.com",
>                         default_operator => "AND"
>                     }
>                 }
>             }
>         }
>     }
> );
>
> print Dumper($res);
>
>
> The generated curl is:
>
> # Request to: https://service.host.com:443/api/es/a_path
> curl -XGET 'http://localhost:9200/_search?api_key=API_KEY&pretty=1' -d '
> {
>    "query" : {
>       "bool" : {
>          "must" : {
>             "query_string" : {
>                "query" : "thisisasitethatdoesntexist.com",
>                "default_field" : "_all",
>                "default_operator" : "AND"
>             }
>          }
>       }
>    }
> }
> '
>
> When I replace localhost and the path with the proper host and path and 
> run the curl command directly from the command line, I get zero hits back, 
> which is what I expect.  If I run the above perl, however, I get many 
> millions of results back, which is exactly the same as what I get when I 
> remove the body from the curl query (-d ''). So it seems that the 
> combination of params and body causes body to get eaten?  I looked at the 
> code, but I couldn't find where this might be happening.  Any help?
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/305579f6-9b50-4d0b-a678-510400cdd78e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to