Basically I am trying to show all index type entries. Now, if you use match_all () in a query elasticsearch shows 10 results by default. You can show all the results by scrolling. I am trying to implement scroll api but cannot make it work. It shows only 10 results, my code is:
module.exports.searchAll = function (searchData, callback) { client.search({ index: 'test', type: 'records', scroll: '10s', //search_type: 'scan', //if I use search_type then it requires size otherwise it shows 0 result body: { query: { "match_all": {} } } }, function (err, resp) { client.scroll({ scrollId: resp._scroll_id, scroll: '10s' }, callback(resp.hits.hits)); }); }
Can anyone help please?
Jane source share