Skip to content

Commit 6a3603a

Browse files
author
Codehardt
committed
fix: fixed missing * in ElasticSearch's wildcard query
1 parent 6eaa4d2 commit 6a3603a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

export.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
// ExportElasticSearchQuery exports the compiled query into an ElasticSearch query, e.g.
88
// `"foo" OR "baz"` will be compiled to
9-
// {"bool":{"should":[{"wildcard":{"raw":{"case_insensitive":false,"value":"foo"}}},{"wildcard":{"raw":{"case_insensitive":false,"value":"bar"}}}]}}
9+
// {"bool":{"should":[{"wildcard":{"raw":{"case_insensitive":false,"value":"*foo*"}}},{"wildcard":{"raw":{"case_insensitive":false,"value":"*bar*"}}}]}}
1010
func (e *Evalostic) ExportElasticSearchQuery(wildcardField string) string {
1111
b, _ := json.Marshal(e.ExportElasticSearchQueryMap(wildcardField))
1212
return string(b)
@@ -33,7 +33,7 @@ func (e *Evalostic) exportElasticSearchQuerySub(wildcardField string, indexToStr
3333
wildcard := map[string]interface{}{
3434
"wildcard": map[string]interface{}{
3535
wildcardField: map[string]interface{}{
36-
"value": indexToStrings[entry.value],
36+
"value": "*" + indexToStrings[entry.value] + "*",
3737
"case_insensitive": entry.ci,
3838
},
3939
},

0 commit comments

Comments
 (0)