aquasecurity / esquery

An idiomatic Go query builder for ElasticSearch
Apache License 2.0
305 stars 56 forks source link

Support _source, sort and post_filter in search requests #10

Closed ido50 closed 4 years ago

ido50 commented 4 years ago

This PR adds the ability to use the "sort", "_source" and "post_filter" attributes in search requests, via the new methods Sort, SourceIncludes and SourceExcludes.

For example:

        esquery.Search().
            Query(...).
            Aggs(...).
            Sort("field_1", esquery.OrderAsc).
            Sort("field_2", esquery.OrderDesc).
            PostFilter(esquery.Range(field).Gt(0)).
            SourceIncludes("field_1", "field_2").
            SourceExcludes("field_3").
            Run(...)
ido50 commented 4 years ago

@oranmoshai