Script fields returning 0 for half_float field

Hi there,

I have the following nested mapping:

my_object_nested_field, type: nested {
    my_inner_object {
        my_field, type: half_float
    }
}

My _source clause contains the 'my_object_nested_field.my_inner_object.my_field' and almost all returned docs contain some value on it.

I declared the following script_field, JUST TO TEST IT:

script_fields: {
   my_script_field: {
         script: {
              inline: "doc['my_object_nested_field.my_inner_object.my_field'].value"
         }
   }
}

But all my_script_field, from all documents, are returned '0'.

Does anybody know what am I doing wrong? Does it have to do with my scrip declaration?
Does it have to do with the fact that it's a nested field? I've tried with a another field that is outside the nested structure, and it worked!

Thanks in advance!

Guilherme

Hi!

I've solved it with params['_source']['my_object_nested_field']['my_inner_object']['my_field'].

It seems it isn't possible to use doc[...].value for nested fields.

thanks!

It seems it isn't possible to use doc[...].value for nested fields.

That is correct. See

Thank you, @rjernst

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.