How to retrieve recursive values in scripted field

Hi !
I work on a professional project with Kibana V5. I use mainly the Painless language with of scripted fields. In scripted fields, I use the "doc['field.keyword'].value" method to retrieve the value. In this project , there are many recursive fields. So several values that I retrieve.
In some cases, there are many recursive values but with the "doc['SgmStatus.keyword']" method , I can only get 1 value.
For example :
Display kibana discover :
result field : SgmStatus (SS , SS, SS)
result scripted fields : SgmStatus (SS)
The doc['SgmStatus.keyword'].length method return "1" while there are "3".

here is a displayed example :
SgmStatus (field)
FieldStatusResultat (Scripted fields)


How to retrieve recursive values in scripted field please ?
I will need a solution in "the scripted field" to get all the values of the "SgmStatus" recursive field even if the values are identical.
thanks in advance !!!


I created a scripted field on a field of array and length is working for me. Can you please check your json and see if your field looks like this?

"fields": {
    "relatedContent.article:modified_time": [



Thank you for your help. The json field looks like that :

how is it that if I call the: " doc ['SgmStatus.keyword']. length; " method, I have a return equal to 1?


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