Update in multi level

Hi,

I've some file which looks like that :

id
description

primary_tag
tag : value
tag : value
primary_tag
tag : value
...

The two first line has already here but the other can be more
important or unexists so i've a script which puts in a array all
primary_tag, in other the tag and one other array contain values.

So to index them i've done :

$result = $es->index(
index => $index,
type => $type,
id => $i,
data => {
id => $id,
DESC => $desc
},
);

my $k = 0;
foreach my $features_object (@features){

					my $bornes = $bornes_inf[$k]."..".$bornes_sup[$k];

					my $primary_tag = $features_object->primary_tag();
					$primary_tag = uc($primary_tag);

					for($features_object->get_all_tags()){

						my $tag = $_;

						for my $valeur ($features_object->get_tag_values($tag)){

							$result = $es->update(
								index	=>	$index,
								type	=>	$type,
								id		=>	$i,

								script	=> 	"ctx._source[\"$primary_tag\_$bornes/$tag\"]=

"$valeur"",
params => {"$primary_tag_$bornes/$tag" => 'ok'}
);
}
}
$k++;
}

The problem is that script index data with field : prymary_tag/bornes/
tag : value because some tag can be similar so i use "borne" to
differency them.

I search a script for updating like that :

primary_tag { tag1 : "value", tag2 : "value" }

I've try this script but it does'nt works :

"if(ctx._source.$primary_tag_$bornes["$tag"]==null) { ctx._source.
$primary_tag_$bornes["$tag"] = "$value"} else {ctx._source.
$primary_tag_$bornes["$tag"] += " $value"}"

I want this script do :

if the tag in the primary tag we works is undef, add $primary_tag_
$bornes{ $tag : "$value" }, else add just the value to the fields.

The problem is not var's name, i change it in my code and the problem
still here.

I have no idea

On 9 mai, 15:14, Jérome pivertjer...@gmail.com wrote:

Hi,

I've some file which looks like that :

id
description

primary_tag
tag : value
tag : value
primary_tag
tag : value
...

The two first line has already here but the other can be more
important or unexists so i've a script which puts in a array all
primary_tag, in other the tag and one other array contain values.

So to index them i've done :

$result = $es->index(
index => $index,
type => $type,
id => $i,
data => {
id => $id,
DESC => $desc
},
);

my $k = 0;
foreach my $features_object (@features){

                                            my $bornes = $bornes_inf[$k]."..".$bornes_sup[$k];

                                            my $primary_tag = $features_object->primary_tag();
                                            $primary_tag = uc($primary_tag);

                                            for($features_object->get_all_tags()){

                                                    my $tag = $_;

                                                    for my $valeur ($features_object->get_tag_values($tag)){

                                                            $result = $es->update(
                                                                    index   =>   $index,
                                                                    type    =>   $type,
                                                                    id              =>   $i,

                                                                    script  =>   "ctx._source[\"$primary_tag\_$bornes/$tag\"]=

"$valeur"",
params => {"$primary_tag_$bornes/$tag" => 'ok'}
);
}
}
$k++;
}

The problem is that script index data with field : prymary_tag/bornes/
tag : value because some tag can be similar so i use "borne" to
differency them.

I search a script for updating like that :

primary_tag { tag1 : "value", tag2 : "value" }

Hard to tell what you are trying to do, is there a chance for a simple curl
recreation? (see Elasticsearch Platform — Find real-time answers at scale | Elastic).

On Wed, May 9, 2012 at 5:03 PM, Jérome pivertjerome@gmail.com wrote:

I've try this script but it does'nt works :

"if(ctx._source.$primary_tag_$bornes["$tag"]==null) { ctx._source.
$primary_tag_$bornes["$tag"] = "$value"} else {ctx._source.
$primary_tag_$bornes["$tag"] += " $value"}"

I want this script do :

if the tag in the primary tag we works is undef, add $primary_tag_
$bornes{ $tag : "$value" }, else add just the value to the fields.

The problem is not var's name, i change it in my code and the problem
still here.

I have no idea

On 9 mai, 15:14, Jérome pivertjer...@gmail.com wrote:

Hi,

I've some file which looks like that :

id
description

primary_tag
tag : value
tag : value
primary_tag
tag : value
...

The two first line has already here but the other can be more
important or unexists so i've a script which puts in a array all
primary_tag, in other the tag and one other array contain values.

So to index them i've done :

$result = $es->index(
index => $index,
type => $type,
id => $i,
data => {

    id                      => $id,
    DESC                    => $desc

},

                                    );

my $k = 0;
foreach my $features_object
(@features){

                                            my $bornes =

$bornes_inf[$k]."..".$bornes_sup[$k];

                                            my $primary_tag =

$features_object->primary_tag();

                                            $primary_tag =

uc($primary_tag);

for($features_object->get_all_tags()){

                                                    my $tag = $_;

                                                    for my $valeur

($features_object->get_tag_values($tag)){

                                                            $result

= $es->update(

index => $index,

type => $type,

id => $i,

script => "ctx._source["$primary_tag_$bornes/$tag"]=

"$valeur"",

params => {"$primary_tag_$bornes/$tag" => 'ok'}

                                                            );
                                                    }
                                            }
                                            $k++;
                                    }

The problem is that script index data with field : prymary_tag/bornes/
tag : value because some tag can be similar so i use "borne" to
differency them.

I search a script for updating like that :

primary_tag { tag1 : "value", tag2 : "value" }