Last active
August 29, 2015 14:07
-
-
Save szabgab/58f8fb6e345a567de506 to your computer and use it in GitHub Desktop.
MetaCPAN API error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Data::Dumper qw(Dumper); | |
use HTTP::Tiny; | |
use JSON qw(to_json); | |
my $ua = HTTP::Tiny->new(); | |
my $query_json = to_json { | |
query => { | |
match_all => {}, | |
"range" => { | |
"date" => { | |
"from" => "2010-06-05T00:00:00", | |
"to" => "2011-06-05T00:00:00", | |
}, | |
}, | |
}, | |
}; | |
print Dumper $ua->request( | |
'POST', | |
'http://api.metacpan.org/v0/release/_search', | |
{ | |
headers => { 'Content-Type' => 'application/json' }, | |
content => $query_json, | |
} | |
); | |
$VAR1 = { | |
'status' => '500', | |
'protocol' => 'HTTP/1.1', | |
'success' => '', | |
'headers' => { | |
'connection' => 'keep-alive', | |
'content-length' => '941', | |
'date' => 'Wed, 22 Oct 2014 14:34:17 GMT', | |
'surrogate-control' => 'no-store', | |
'server' => 'nginx/1.6.2', | |
'content-type' => 'text/plain; charset=UTF-8' | |
}, | |
'content' => 'SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[MviAwe4BT1-a4OcbrYWb0g][cpan_v1][2]: SearchParseException[[cpan_v1][2]: query[ConstantScore(NotDeleted(*:*))],from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"match_all":{},"range":{"date":{"from":"2010-06-05T00:00:00","to":"2011-06-05T00:00:00"}}}}]]]; nested: SearchParseException[[cpan_v1][2]: query[ConstantScore(NotDeleted(*:*))],from[-1],size[-1]: Parse Failure [No parser for element [date]]]; }{[MviAwe4BT1-a4OcbrYWb0g][cpan_v1][0]: SearchParseException[[cpan_v1][0]: query[ConstantScore(NotDeleted(*:*))],from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"match_all":{},"range":{"date":{"from":"2010-06-05T00:00:00","to":"2011-06-05T00:00:00"}}}}]]]; nested: SearchParseException[[cpan_v1][0]: query[ConstantScore(NotDeleted(*:*))],from[-1],size[-1]: Parse Failure [No parser for element [date]]]; }]', | |
'reason' => 'Internal Server Error', | |
'url' => 'http://api.metacpan.org/v0/release/_search' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment