var arr = [{
elements: [{
id: '123',
field: 'value'
}, {
id: '456',
field: 'value'
}]
}, {
elements: [{
id: '789',
field: 'value'
}]
}]
var i = arr.findIndex(function(o) {
return o.elements.some(function(e) {
return e.id == 456;
})
})
console.log(i)
Run code snippet