This is related to the a question I have asked previously. I have corrected my route according the answer give by @Val. With that I have an array containing arrays which has JSON objects. Ex:
[
[{_index:'myIndex',_type:'myType',_source:{name:'Name',age:25}},
{_index:'myIndex',_type:'myType',_source:{name:'Name',age:25}}
],
[{_index:'myIndex',_type:'myType',_source:{name:'Name',age:25}},
{_index:'myIndex',_type:'myType',_source:{name:'Name',age:25}}
]
]
So in my ejs file I am iterating through array as follows.
<% if(locals.players){ %>
<% for(var i=0;locals.players.length;i++){ %>
//some more code
<% var tp = locals.players[i]; %>
<% for(var j=0;tp.length;j++){ %>
<ul>
<li>
Name:<%= tp[j]._source.name %><br>
Age:<%= tp[j]._source.age %>
</li>
</ul>
<% } %>
<% } } %>
But I receive an error 'property _source undefined'. Just to add more details: the results array is coming from elasticsearch query. My intention is to print more results of another query which has objects from 1-D array. Second array contains arrays of results which correspond to each object in 1-D array.
-
Name:<%= locals.teams[i]._source.name %>
<%}}%>`