Skip to content

Commit

Permalink
reverse hits list so top documents by sort are drawn on top
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Oct 7, 2019
1 parent 60284c5 commit 249ac40
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class ESSearchSource extends AbstractESSource {
entityBuckets.forEach(entityBucket => {
const total = _.get(entityBucket, 'entityHits.hits.total', 0);
const hits = _.get(entityBucket, 'entityHits.hits.hits', []);
// Reverse hits list so they are drawn from oldest to newest (per entity) so newest events are on top
// Reverse hits list so top documents by sort are drawn on top
allHits.push(...hits.reverse());
if (total > hits.length) {
hasTrimmedResults = true;
Expand Down Expand Up @@ -238,7 +238,7 @@ export class ESSearchSource extends AbstractESSource {
const resp = await this._runEsQuery(layerName, searchSource, registerCancelCallback, 'Elasticsearch document request');

return {
hits: resp.hits.hits,
hits: resp.hits.hits.reverse(), // Reverse hits so top documents by sort are drawn on top
meta: {
areResultsTrimmed: resp.hits.total > resp.hits.hits.length
}
Expand Down

0 comments on commit 249ac40

Please sign in to comment.