// newFilterAggregationForFacet initializes the aggregation with filters applied to the other fields
//  to get the correct facet count for the given field
newFilterAggregationForFacet initializes the aggregation with filters applied to the other fields
to get the correct facet count for the given field
// newFilterAggregationForFacet initializes the aggregation with filters applied to the other fields // to get the correct facet count for the given field
func newFilterAggregationForFacet(field string, filters []elastic.Query) elastic.Aggregation {
	if len(filters) == 0 {
		return elastic.NewTermsAggregation().Field(field).Size(30)
	}
	return elastic.NewFiltersAggregation().
		Filters(filters...).
		SubAggregation(field, elastic.NewTermsAggregation().Field(field).Size(30))
}
func newFilterAggregationForFacet ( field string , filters [ ] elastic . Query ) elastic . Aggregation { if len ( filters ) == 0 { return elastic . NewTermsAggregation ( ) . Field ( field ) . Size ( 30 ) } return elastic . NewFiltersAggregation ( ) . Filters ( filters ... ) . SubAggregation ( field , elastic . NewTermsAggregation ( ) . Field ( field ) . Size ( 30 ) ) }
newFilterAggregationForFacet initializes the aggregation with filters applied to the other fields
to get the correct facet count for the given field
newFilterAggregationForFacet initializes the aggregation with filters applied to the other fields to get the correct facet count for the given field
// We can't use filters aggregation when 0 filters