Initial commit

This commit is the initial commit for a Go library providing an
idiomatic, easy-to-use query builder for ElasticSearch. The library can
build queries and execute them using the structures from the official Go
SDK provided by the ES project (https://github.com/elastic/go-elasticsearch).

The library currently provides the capabilities to create and execute
simple ElasticSearch queries, specifically Match queries (match,
match_bool_prefix, match_phrase and match_phrase_prefix), Match All
queries (match_all, match_none), and all of the Term-level queries (e.g.
range, regexp, etc.).

Unit tests are included for each support query, and the code is linted
using golangci-lint (see enabled linters in .golangci-lint). The unit
tests currently only verify the builder creates valid JSON queries and
does not attempt to actually run queries against a (mock) ES instance.
This commit is contained in:
Ido Perlmuter
2020-02-20 11:50:11 +02:00
parent b6dbef6245
commit 9ef149ec94
11 changed files with 921 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
package esquery
import (
"testing"
)
func TestMatchAll(t *testing.T) {
runTests(t, []queryTest{
{"match_all without a boost", MatchAll(), "{\"match_all\":{}}\n"},
{"match_all with a boost", MatchAll().Boost(2.3), "{\"match_all\":{\"boost\":2.3}}\n"},
{"match_none", MatchNone(), "{\"match_none\":{}}\n"},
})
}