Skip to content

Commit

Permalink
correcting a bug with export, by default export was limited to 10 obj…
Browse files Browse the repository at this point in the history
…ects
  • Loading branch information
llavaud committed Jul 5, 2017
1 parent 97f0acf commit 8d6cdfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kbt
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ $ctype, $ctitle

my $ua = LWP::UserAgent->new;
$ua->ssl_opts('verify_hostname' => '0') if defined $ssl_noverify;
my $request = HTTP::Request->new(POST => "$scheme://$host:$port/$index/$t/_search");
my $request = HTTP::Request->new(POST => "$scheme://$host:$port/$index/$t/_search?size=1000&scroll=1m&sort=_doc");
$request->content('{"query":{"match_all":{}}}');
$request->accept_decodable();
my $response = $ua->request($request);

if ($response->is_success) {
Expand Down Expand Up @@ -113,6 +114,7 @@ sub export {
$ua->ssl_opts('verify_hostname' => '0') if defined $ssl_noverify;
my $request = HTTP::Request->new(POST => "$scheme://$host:$port/$index/_mget");
$request->content($json);
$request->accept_decodable();
my $response = $ua->request($request);

if ($response->is_success) {
Expand Down Expand Up @@ -162,6 +164,7 @@ sub import {
$ua->ssl_opts('verify_hostname' => '0') if defined $ssl_noverify;
my $request = HTTP::Request->new(POST => "$scheme://$host:$port/$index/$doc->{'_type'}/$doc->{'_id'}$create");
$request->content(to_json($doc->{'_source'}));
$request->accept_decodable();
my $response = $ua->request($request);
print STDERR "Failed to import \'$doc->{'_id'}\' ($doc->{'_type'}): ".$response->status_line."\n"
if (!$response->is_success and $response->code != 409);
Expand Down Expand Up @@ -207,6 +210,6 @@ Laurent Lavaud
=head1 VERSION
0.9
0.10
=cut
Binary file modified man1/kbt.1.gz
Binary file not shown.

0 comments on commit 8d6cdfa

Please sign in to comment.