Add support for compound queries
This commit adds support for the compound queries "bool", "boosting",
"constant_score" and "dis_max". The "function_score" query is not
supported yet.
Compound queries are simple. They act just like simple queries, except
that they are recursive, wrapping other simple/compound queries.
For example:
esquery.Bool().
Must(Term("user", "kimchy"), Term("author", "kimchy")).
Filter(Term("tag", "tech"))
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package esquery
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBoost(t *testing.T) {
|
||||
runTests(t, []queryTest{
|
||||
{
|
||||
"boosting query",
|
||||
Boosting().
|
||||
Positive(Term("text", "apple")).
|
||||
Negative(Term("text", "pie tart")).
|
||||
NegativeBoost(0.5),
|
||||
"{\"boosting\":{\"positive\":{\"term\":{\"text\":{\"value\":\"apple\"}}},\"negative\":{\"term\":{\"text\":{\"value\":\"pie tart\"}}},\"negative_boost\":0.5}}\n",
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user