I have an array of objects as shown below
Array1
(4) [{_index: "sitelist", _source:{dma: 1 , site :4}},{_index: "sitelist", _source:{dma: 2 , site :4}},{_index: "sitelist", _source:{dma: 3 , site :4}},{_index: "sitelist", _source:{dma: 4, site :4}}]
Now i wanted to retrieve the source object and store it in an array , desired output should be
Array2
(4) [{dma: 1 , site :4},{dma: 2 , site :4},{dma: 3 , site :4},{dma: 4 , site :4}]
I have tried using the filter function as
let Array2 = Array1.filter(function(obj){
return obj._source;
});
When i console.log(Array2) i am not getting the desired result, i am getting Array1 values, How to get the proper output, any help appreciated.?