Filter on buckets only when there is some bucket selected (#289)

otherwise the query is malformed
This commit is contained in:
Rok Garbas 2021-02-07 19:24:00 +01:00 committed by GitHub
parent cfb5e540b9
commit 7c89b2349c
Failed to generate hash of commit

View file

@ -1095,9 +1095,15 @@ makeRequestBody query from sizeRaw sort type_ sortField otherSortFields bucketsF
, Json.Encode.object
[ ( "filter"
, Json.Encode.list Json.Encode.object
[ filterByType type_
, filterByBuckets
]
(List.append
[ filterByType type_ ]
(if List.isEmpty filterByBuckets then
[]
else
[ filterByBuckets ]
)
)
)
, ( "must"
, Json.Encode.list Json.Encode.object