File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -64,33 +64,34 @@ ($range)
6464
6565 my $files = $es -> scroll(
6666 scroll => ' 5m' ,
67- fields => [qw< id documentation > ],
6867 body => {
6968 query => {
7069 bool => {
7170 must => [
7271 { exists => { field => " documentation" } }, $range
7372 ],
7473 }
75- }
74+ },
75+ _source => [qw< id documentation > ],
76+ size => 500,
77+ sort => ' _doc' ,
7678 },
7779 );
7880
7981 my $bulk = $es -> bulk( timeout => ' 5m' );
8082
8183 while ( my $file = $files -> next ) {
82- my $documentation = $file -> {fields }{documentation }[0] ;
84+ my $documentation = $file -> {_source }{documentation };
8385 my $weight = 1000 - length ($documentation );
8486 $weight = 0 if $weight < 0;
8587
8688 $bulk -> update( {
87- id => $file -> {fields }{ id }[0] ,
89+ id => $file -> {_id } ,
8890 doc => {
8991 suggest => {
9092 input => [$documentation ],
91- payload => { doc_name => $documentation },
9293 weight => $weight ,
93- }
94+ },
9495 },
9596 } );
9697 }
You can’t perform that action at this time.
0 commit comments