From cdf5d532a51d950d748986540989c3d8112d8f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20R=C3=BCegg?= Date: Mon, 16 Mar 2020 15:27:28 +0100 Subject: [PATCH] Simplify search query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By introducing a type alias for the used map. Signed-off-by: Simon Rüegg --- pkg/elasticsearch/search.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/elasticsearch/search.go b/pkg/elasticsearch/search.go index 241eba1..6c2838d 100644 --- a/pkg/elasticsearch/search.go +++ b/pkg/elasticsearch/search.go @@ -14,14 +14,15 @@ import ( func (c client) SearchUniqueID(uniqueID string) (model.SearchResult, error) { var buf bytes.Buffer - query := map[string]interface{}{ - "query": map[string]interface{}{ - "bool": map[string]interface{}{ - "should": []map[string]interface{}{{ - "match": map[string]interface{}{ + type m map[string]interface{} + query := m{ + "query": m{ + "bool": m{ + "should": []m{{ + "match": m{ "apache-access.uniqueID": uniqueID, }}, { - "match": map[string]interface{}{ + "match": m{ "modsec-alert.uniqueID": uniqueID, }}, },