Exemple #1
0
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)
}
Exemple #2
0
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
}