forked from aquasecurity/esquery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
query_multi_match_test.go
63 lines (61 loc) · 1.84 KB
/
query_multi_match_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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package query
import (
"testing"
)
func TestMultiMatch(t *testing.T) {
runMapTests(t, []mapTest{
{
"simple multi_match",
MultiMatch([]string{"title"}, "value1", "value2"),
map[string]interface{}{
"multi_match": map[string]interface{}{
"fields": []string{"title"},
"query": "value2",
},
},
},
{
"multi_match all params",
MultiMatch([]string{"title", "body"}, "original").
Query("test").
Analyzer("stop").
AutoGenerateSynonymsPhraseQuery(true).
Fuzziness("AUTO").
MaxExpansions(16).
PrefixLength(12).
TieBreaker(0.3).
Boost(6.4).
Transpositions(true).
FuzzyRewrite("scoring_boolean").
Lenient(true).
Operator(OperatorAnd).
Type(MatchTypePhrase).
MinimumShouldMatch("3<90%").
Slop(2).
ZeroTermsQuery(ZeroTermsAll).
Name("query_name"),
map[string]interface{}{
"multi_match": map[string]interface{}{
"analyzer": "stop",
"auto_generate_synonyms_phrase_query": true,
"boost": 6.4,
"fuzziness": "AUTO",
"fuzzy_rewrite": "scoring_boolean",
"lenient": true,
"max_expansions": 16,
"minimum_should_match": "3<90%",
"prefix_length": 12,
"transpositions": true,
"type": "phrase",
"tie_breaker": 0.3,
"operator": "AND",
"zero_terms_query": "all",
"slop": 2,
"query": "test",
"fields": []string{"title", "body"},
"_name": "query_name",
},
},
},
})
}