func (r *ElasticRequest) Scope(ts *opentsdb.TagSet) { var filters []elastic.Query for tagKey, tagValue := range *ts { filters = append(filters, elastic.NewTermQuery(tagKey, tagValue)) } b := elastic.NewBoolQuery().Must(filters...) r.Source = r.Source.Query(b) }
func ScopeES(ts opentsdb.TagSet, q elastic.Query) elastic.Query { var filters []elastic.Query for tagKey, tagValue := range ts { filters = append(filters, elastic.NewTermQuery(tagKey, tagValue)) } filters = append(filters, q) b := elastic.NewBoolQuery().Must(filters...) return b }