Skip to content

Commit

Permalink
Fetch all fields, not _source
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Sep 17, 2020
1 parent 29f6740 commit 61b7fb0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/plugins/discover/public/application/angular/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,9 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
}

$scope.hits = resp.hits.total;
$scope.rows = resp.hits.hits;
$scope.rows = resp.hits.hits.map((hit) => {
return { ...hit, ...{ _source: hit.fields } };
});

// if we haven't counted yet, reset the counts
const counts = ($scope.fieldCounts = $scope.fieldCounts || {});
Expand Down Expand Up @@ -938,14 +940,10 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise

$scope.updateDataSource = () => {
const { indexPattern, searchSource } = $scope;
const { docvalueFields } = indexPattern.getComputedFields();
const columns = $scope.state.columns.filter(
(name) => !docvalueFields.find((docVal) => docVal.field === name)
);
searchSource
.setField('index', $scope.indexPattern)
.setField('fieldsApi', columns)
.setField('source', true)
.setField('fieldsApi', ['*'])
.setField('source', false)
.setField('size', $scope.opts.sampleSize)
.setField(
'sort',
Expand Down

0 comments on commit 61b7fb0

Please sign in to comment.