I'm doing elasticsearch in node js. Through 'client.search', I can get data from elasticsearch, but I just want to get '_source' field. How can I do this??
Through javascript 'map' function, I can get only _source data. However, I want to know what is the body option in 'client.search' to get only source data.
This is my code that is used map function.
index: 'bank',
body:{
query:{
"bool":{
"must":{"match":{"state":"AL"}}
}
}
}
}, function getMore(err,data){
if(err)
{
console.log(err);
return;
}
var source = data.hits.hits.map(function(obj){
return obj._source;
});
console.log(source);
res.end(source);
});