From bf34c114123f39bfa566f938b54e5e64f9d16f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Thu, 31 Dec 2020 11:56:30 +0100 Subject: [PATCH] =?UTF-8?q?On=20joue=20avec=20les=20requ=C3=AAtes=20Elasti?= =?UTF-8?q?csearch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/emails_controller.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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