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
|