ES Query DSL
Structs and marshal-ers that help wrangle writing elastic search queries using the ES query DSL spec
Installation
go get github.com/mottaquikarim/esquerydsl
Usage
package main
import (
"fmt"
"github.com/mottaquikarim/esquerydsl"
)
func main() {
_, body, _ := esquerydsl.GetQueryBlock(esquerydsl.QueryDoc{
Index: "some_index",
Sort: []map[string]string{map[string]string{"id": "asc"}},
And: []esquerydsl.QueryItem{
esquerydsl.QueryItem{
Field: "some_index_id",
Value: "some-long-key-id-value",
Type: "match",
},
},
})
fmt.Println(body)
// {"query":{"bool":{"must":[{"match":{"some_index_id":"some-long-key-id-value"}}]}},"sort":[{"id":"asc"}]}
}
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Run Tests
make test
Format
make fmt
Lint
make lint