esquery/query_multi_match_test.go

63 lines
1.8 KiB
Go
Raw Normal View History

2020-10-17 19:41:45 +00:00
package esquery
import (
"testing"
)
func TestMultiMatch(t *testing.T) {
runMapTests(t, []mapTest{
{
"simple multi_match",
2020-10-17 19:46:37 +00:00
MultiMatch("value1", "value2").Fields("title"),
2020-10-17 19:41:45 +00:00
map[string]interface{}{
"multi_match": map[string]interface{}{
"fields": []string{"title"},
2020-10-17 19:46:37 +00:00
"query": "value2",
2020-10-17 19:41:45 +00:00
},
},
},
{
"multi_match all params",
MultiMatch("original").
2020-10-17 19:46:37 +00:00
Query("test").
Analyzer("stop").
Fields("title", "body").
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),
2020-10-17 19:41:45 +00:00
map[string]interface{}{
"multi_match": map[string]interface{}{
2020-10-17 19:46:37 +00:00
"analyzer": "stop",
2020-10-17 19:41:45 +00:00
"auto_generate_synonyms_phrase_query": true,
2020-10-17 19:46:37 +00:00
"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"},
2020-10-17 19:41:45 +00:00
},
},
},
})
}