Very nice. Tq But I got another problem. After changing the values in the hash I tried to insert the doc into ES again. But its showing below mentioned error.

[Request] ** [http://172.16.15.153:9200]-[400] [mapper_parsing_excepti +on] failed to parse, called from sub Search::Elasticsearch::Role::Cli +ent::Direct::__ANON__ at ./complex_regex_bkp.pl line 93. With vars: { +'body' => {'status' => 400,'error' => {'root_cause' => [{'reason' => +'failed to parse','type' => 'mapper_parsing_exception'}],'reason' => +'failed to parse','type' => 'mapper_parsing_exception','caused_by' => + {'reason' => 'Mixing up field types: class org.elasticsearch.index.m +apper.core.StringFieldMapper$StringFieldType != class org.elasticsear +ch.index.mapper.internal.IndexFieldMapper$IndexFieldType on field _in +dex','type' => 'illegal_state_exception'}}},'request' => {'serialize' + => 'std','path' => '/my_app/blog_post/1','ignore' => [],'mime_type' +=> 'application/json','body' => {'_source' => {'sheets' => {'sheet1' +=> {'Sheet_Name' => 'Ex-Sheet','forumle' => [{'1' => {'colName' => 'E +x-Col1','formula' => '{"query":{"constant_score":{"filter":{"bool":{" +should":[{"bool":{"must":[{"term":{"column08":"Submit"}},{"term":{"co +lumn10":"Delivered"}},{"term":{"column09":"Something"}}]}},{"bool":{" +must":[{"term":{"column08":"Delivered"}},{"term":{"column09":"Somethi +ng"}}]}}]}}}}}','total' => 'false'},'0' => {'colName' => 'Ex-Col1','f +ormula' => '{"query":{"constant_score":{"filter":{"bool":{"should":[{ +"bool":{"must":[{"term":{"column08":"Submit"}},{"term":{"column10":"D +elivered"}},{"term":{"column09":"Something"}}]}},{"bool":{"must":[{"t +erm":{"column08":"Delivered"}},{"term":{"column09":"Something"}}]}},{ +"bool":{"must":[{"term":{"column08":"Submit"}},{"term":{"column10":"D +elivered"}},{"term":{"column09":"Something"}}]}},{"bool":{"must":[{"t +erm":{"column08":"Delivered"}},{"term":{"column09":"Something"}}]}}]} +}}}}','total' => 'false'},'2' => {'colName' => 'Ex-Col1','formula' => + '{"query":{"constant_score":{"filter":{"bool":{"must":[{"term":{"col +umn08":"Submit"}},{"term":{"column10":"Delivered"}},{"term":{"column0 +9":"Something"}}]}}}}}','total' => 'false'}}]}}},'_index' => 'testing +','_id' => '2','_type' => 'mytype','found' => bless( do{\(my $o = 1)} +, 'JSON::XS::Boolean' ),'_version' => 20},'qs' => {},'method' => 'POS +T'},'status_code' => 400}

I know the elastic search needs JSON data as a body. So I tried to convert this into JSON.

#my $temp = bless $doc; #my $json = encode_json \%temp;

Then the data is updated without error but the data in DB is like "_source": {"main:HASH(0x25d3100)}". Any help on inserting the data back again


In reply to Re^2: Return value of Search::Elasticsearch search query by ravi45722
in thread Return value of Search::Elasticsearch search query by ravi45722

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.