Gives error when creating scripted field using nested json

I am trying to fetch email address from the logs. changesets.values is an array and it can be empty so taht is why i am using conditional statement. Code below gives error.

doc['changesets.values[0].toCommit.author.emailAddress'].empty ? "default" : doc['changesets.values[0].toCommit.author.emailAddress'].value

Extracted fields in logstash, that worked.

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