Re: Perl client: Cannot combine params and body?

2015-01-21 Thread Andrew Walker
I have submitted an issue. Thanks for your attention!

On Wednesday, January 21, 2015 at 1:41:39 PM UTC-5, Andrew Walker wrote:
>
> I forgot to mention that; it's commented out because the service I'm 
> attempting to access refuses POST requests.  I've been informed that this 
> is a sort of low-hanging fruit security measure to prevent mutating methods.
>
> On Wednesday, January 21, 2015 at 1:17:07 PM UTC-5, Clinton Gormley wrote:
>>
>> Hi Andrew
>>
>> The code looks correct.  You have send_get_body_as POST commented out - 
>> I'm guessing that is the problem.  Probably the service you're using does 
>> not allow GET requests with bodies.
>>
>> I'd uncomment that and try again.
>>
>> Ping me on https://github.com/elasticsearch/elasticsearch-perl/issues if 
>> you still can't get it working
>>
>> clint
>>
>>

-- 
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/9be4fff4-537a-4370-9427-1ac903af18a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Perl client: Cannot combine params and body?

2015-01-21 Thread Andrew Walker
I forgot to mention that; it's commented out because the service I'm 
attempting to access refuses POST requests.  I've been informed that this 
is a sort of low-hanging fruit security measure to prevent mutating methods.

On Wednesday, January 21, 2015 at 1:17:07 PM UTC-5, Clinton Gormley wrote:
>
> Hi Andrew
>
> The code looks correct.  You have send_get_body_as POST commented out - 
> I'm guessing that is the problem.  Probably the service you're using does 
> not allow GET requests with bodies.
>
> I'd uncomment that and try again.
>
> Ping me on https://github.com/elasticsearch/elasticsearch-perl/issues if 
> you still can't get it working
>
> clint
>
>

-- 
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/7c649cb3-f934-4f74-bc74-bf5eedf22bb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Perl client: Cannot combine params and body?

2015-01-21 Thread Andrew Walker
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.


Perl client: Cannot combine params and body?

2015-01-15 Thread Andrew Walker
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/b990961c-a129-4cd0-b1e0-46f33f86c4ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.