Hi, I am trying to capture the runtime error I am getting while using Search::Elasticsearch::Scroll, below is my code.
$hashprimary_index = $es->scroll_helper( index => $primary_index, search_type => 'scan' ); while ($result_pi = $hashprimary_index->next) { #getting error on this + line #do something }
I am getting below error and script fails.
[Missing] ** [http://localhost:9200]-[404] Not Found, called from sub +Search::Elasticsearch::Scroll::next at script/merge_v1.2.pl line 392. + With vars: {'request' => {'serialize' => 'std','ignore' => [],'metho +d' => 'GET','body' => 'c2Nhbjs1OzM2OTE6d1lvWW9YTHZRbVNzZjR3RkdtR3FPZz +szNjkyOndZb1lvWEx2UW1Tc2Y0d0ZHbUdxT2c7MzY5Mzp3WW9Zb1hMdlFtU3NmNHdGR21 +HcU9nOzM2OTU6d1lvWW9YTHZRbVNzZjR3RkdtR3FPZzszNjk0OndZb1lvWEx2UW1Tc2Y0 +d0ZHbUdxT2c7MTt0b3RhbF9oaXRzOjI2MDs=','qs' => {'scroll' => '1m'},'pat +h' => '/_search/scroll','mime_type' => 'application/json'},'status_co +de' => 404,'body' => {'hits' => {'hits' => [],'total' => 260,'max_sco +re' => '0'},'_shards' => {'total' => 5,'failures' => [{'index' => und +ef,'reason' => {'reason' => 'No search context found for id [3691]',' +type' => 'search_context_missing_exception'},'shard' => -1},{'shard' +=> -1,'index' => undef,'reason' => {'reason' => 'No search context fo +und for id [3692]','type' => 'search_context_missing_exception'}},{'i +ndex' => undef,'reason' => {'reason' => 'No search context found for +id [3693]','type' => 'search_context_missing_exception'},'shard' => - +1},{'index' => undef,'reason' => {'reason' => 'No search context foun +d for id [3695]','type' => 'search_context_missing_exception'},'shard +' => -1},{'shard' => -1,'index' => undef,'reason' => {'reason' => 'No + search context found for id [3694]','type' => 'search_context_missin +g_exception'}}],'failed' => 5,'successful' => 0},'took' => 2,'_scroll +_id' => 'c2NhbjswOzE7dG90YWxfaGl0czoyNjA7','timed_out' => bless( do{\ +(my $o = 0)}, 'JSON::PP::Boolean' )}}

I am trying to capture the error and in log and move on with the next loop, but unable to capture it, Eval don't work.

Thanks,

In reply to Capture Elasticsearch Scroll Error by perll

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.