Skip to content

Commit

Permalink
Simplify search query
Browse files Browse the repository at this point in the history
By introducing a type alias for the used map.

Signed-off-by: Simon Rüegg <simon@rueggs.ch>
  • Loading branch information
srueg committed Mar 16, 2020
1 parent 35d5595 commit cdf5d53
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/elasticsearch/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}},
},
Expand Down

0 comments on commit cdf5d53

Please sign in to comment.