func buildElasticsearchQueryOptions(qo types.QueryOptions) map[string]interface{} { m := qo.Map() if len(qo.Aggregate) > 0 { delete(m, "aggregate") m["aggs"] = buildElasticsearchAggregateQuery(qo.Aggregate, qo.Size) // size is set in aggregate query so remove from top level m["size"] = 0 delete(m, "from") } return m }
// Executes the query against the datastore func (ir *VindaluCore) ExecuteQuery(assetType string, userQuery map[string]interface{}, queryOpts *types.QueryOptions) (rslt interface{}, err error) { if queryOpts != nil && queryOpts.Size < 1 { queryOpts.Size = ir.cfg.DefaultResultSize } return ir.datastore.Query(assetType, userQuery, queryOpts, false) }