Access a field in array using Painless scripted field

Hi,
Since nested array is not well supported in Kibana, is there any way I could extract the value from the array using scripted field?

My data looks like this
1st document:

"page_name": [
{
"name": "New York"
},
{
"url": "https://newyork.com"
},
]

2nd document:

"page_name": [
{
"name": "Berlin"
},
{
"url": "https://berlin.de"
},
]

It'd be great if I could use the Tag Cloud and visualize page_name.name
However, it seems not yet supported, so I figured may be I should use scripted field.

What is the script that allows me to access my field page_name.name?

page_name.name should work as a path for the string. Have you tried it and it's not working?

I used

if(doc['page_name.name.keyword']!= null)doc['page_name.name.keyword']

and it still returns nothing, how can I access an index 0 of an array in painless?