Hi !
I've Genbank Flat file (example : http://www.ncbi.nlm.nih.gov/Sitemap/samplerecord.html)
and i want index it.
My problem is the FEATURES, as you can see they're on 2 levels and
they're différent with the file used. So i can't use the index
function.
I used it for indexing all data which are present in any document :
$result = $es->index(
index => $index,
type => $type,
id => $num_acc,
data => {
ACC => $num_acc,
DESC => $desc,
VERSION => $version,
GI => $gi,
ORGANISME => $espece,
CLASSIFICATION => $classification,
SEQUENCE => $seq
},
);
For the FEATURE i use the update funtion :
loop_for_the_primaryTag {
loop_for_the_tag_and_value_from_this_primaryTag {
$result = $es->update(
index => $index,
type => $type,
id => $num_acc,
script => "if(ctx._source.$primary_tag){if(ctx._source.$primary_tag\
["$tag"] == null){ctx._source.$primary_tag["$tag"] = "$value"}
else {ctx._source.$primary_tag["$tag"] += " $value"}}else
{ctx._source.$primary_tag["$tag"] = "$value"}",
);
}
}
I wrote you the script at the bottom.
The objective is :
{
primary_tag : {
tag : value,
tag : value
},
primary_tag2 : {
tag : value
}
}
But the script doesn't works. My question is : Where are the errors in
the script ? Is it possible to do that ?
I think i can use the JSON to index it without this problem but i try
and failed to convert my file in JSON. My second and most important
question is : how can i convert this file in JSON (i read the doc on
CPAN but...) and how can i index it in PERL ?
The pretty script
if(ctx._source.$primary_tag){
if(ctx._source.$primary_tag["$tag"] == null){
ctx._source.$primary_tag["$tag"] = "$value"
}
else {
ctx._source.$primary_tag["$tag"] += " $value"
}
}
else {
ctx._source.$primary_tag["$tag"] = "$value"
}
Thanks for help !
I'll send an SOS to the World
I hope that someone gets my
Message in a forum