forked from defensestation/osquery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery_constant_score_test.go
45 lines (42 loc) · 1.04 KB
/
query_constant_score_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Modified by DefenseStation on 2024-06-06
// Changes: Updated ElasticSearch client to OpenSearch client, changed package name to 'osquery',
// updated references to OpenSearch documentation, and modified examples accordingly.
package osquery
import (
"testing"
)
func TestConstantScore(t *testing.T) {
runMapTests(t, []mapTest{
{
"constant_score query without boost",
ConstantScore(Term("user", "kimchy")),
map[string]interface{}{
"constant_score": map[string]interface{}{
"filter": map[string]interface{}{
"term": map[string]interface{}{
"user": map[string]interface{}{
"value": "kimchy",
},
},
},
},
},
},
{
"constant_score query with boost",
ConstantScore(Term("user", "kimchy")).Boost(2.2),
map[string]interface{}{
"constant_score": map[string]interface{}{
"filter": map[string]interface{}{
"term": map[string]interface{}{
"user": map[string]interface{}{
"value": "kimchy",
},
},
},
"boost": 2.2,
},
},
},
})
}