aquasecurity / esquery

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

Bugfix: Run() fails for queries, add MarshalJSON() #2

Closed ido50 closed 4 years ago

ido50 commented 4 years ago

The Run() method on the QueryRequest type would fail, since it would encode the inner body of the query to JSON and not the complete, outer body (i.e. including the "body: {}" portion).

The commit also adds MarshalJSON() methods to both QueryRequest and AggregationRequest, allowing them to implement the json.Marshaller interface, and providing easier debugging of the library. A test skeleton for this is also added.