diff --git a/app/controllers/emails_controller.rb b/app/controllers/emails_controller.rb index 8e3ce4c..786aa7b 100644 --- a/app/controllers/emails_controller.rb +++ b/app/controllers/emails_controller.rb @@ -7,7 +7,17 @@ class EmailsController < ApplicationController results = email_repository.search({ query: { match_all: {} - } + }, + sort: [{ + date: { order: 'desc' } + }], + size: 100, + from: 0, + aggregations: { + clients: { terms: { field: 'clients.keyword' } }, + servers: { terms: { field: 'servers.keyword' } }, + tickets: { terms: { field: 'tickets.keyword' } } + }, }) @emails = results.results end