// mergedFields returns the fields list collapsed into a single map.
504093
func (e *Entry) mergedFields() Fields {
	f := Fields{}

	for _, fields := range e.fields {
		for k, v := range fields {
			f[k] = v
		}
	}

	return f
}
48032
func Merge(coll1, coll2 []string) []string {
	m := map[string]struct{}{}
	for _, v := range append(coll1, coll2...) {
		m[v] = struct{}{}
	}
	r := make([]string, 0, len(m))
	for k := range m {
		r = append(r, k)
	}
	return r
}
536552
func (s *IndicesStatsService) Fields(fields ...string) *IndicesStatsService {
	s.fields = append(s.fields, fields...)
	return s
}
496393
func (v delegatingStrategy) MergeList(diff apply.ListElement) (apply.Result, error) {
	switch diff.GetFieldMergeType() {
	case apply.MergeStrategy:
		return v.merge.MergeList(diff)
	case apply.ReplaceStrategy:
		return v.replace.MergeList(diff)
	case apply.RetainKeysStrategy:
		return v.retainKeys.MergeList(diff)
	default:
		return v.replace.MergeList(diff)
	}
}
1100695
func (opts Opts) Merged() Opt {
	if len(opts) == 0 {
		return nil
	}
	return func(c *Client) Opt {
		var (
			size = len(opts)
			undo = make(Opts, size)
		)
		size-- // make this a zero-based offset
		for i, opt := range opts {
			if opt != nil {
				undo[size-i] = opt(c)
			}
		}
		return undo.Merged()
	}
}
791761
func merge(appliabels ...[]appliable) []appliable {
	all := []appliable{}

	for _, appl := range appliabels {
		all = append(all, appl...)
	}

	return all
}
57165
func (r *Result) mergeForField(obj map[string]interface{}, field string, other *Result) *Result {
	if other == nil {
		return r
	}
	r.mergeWithoutRootSchemata(other)

	if other.rootObjectSchemata.Len() > 0 {
		if r.fieldSchemata == nil {
			r.fieldSchemata = make([]fieldSchemata, len(obj))
		}
		r.fieldSchemata = append(r.fieldSchemata, fieldSchemata{
			obj:      obj,
			field:    field,
			schemata: other.rootObjectSchemata,
		})
	}

	return r
}
1352337
func (v retainKeysStrategy) MergeList(e apply.ListElement) (apply.Result, error) {
	return apply.Result{}, fmt.Errorf("Cannot use retainkeys with list element %v", e.Name)
}
1215404
func (s *UpdateByQueryService) StoredFields(storedFields ...string) *UpdateByQueryService {
	s.storedFields = storedFields
	return s
}
179275
func MergeFieldsSets(source fields.Set, fragment fields.Set) fields.Set {
	for k, value := range fragment {
		source[k] = value
	}
	return source
}
552631
func NewFields(v map[string]interface{}) Fields {
	fields := make(Fields)
	for k, v := range v {
		fields[k] = v
	}
	return fields
}
335891
func (i *Index) MergeChunks(s index.MergeStrategy) {
	i.idx.MergeChunks(s)
}
88446
func (v replaceStrategy) MergeList(e apply.ListElement) (apply.Result, error) {
	return v.doReplace(e)
}
47820
func (s *SearchSource) PartialField(partialField *PartialField) *SearchSource {
	s.partialFields = append(s.partialFields, partialField)
	return s
}
838441
func Merge(labels1, labels2 Set) Set {
	mergedMap := Set{}

	for k, v := range labels1 {
		mergedMap[k] = v
	}
	for k, v := range labels2 {
		mergedMap[k] = v
	}
	return mergedMap
}
1112159
func mergeMaps(map1, map2 map[interface{}]interface{}) map[interface{}]interface{} {
	result := make(map[interface{}]interface{})
	for k, v2 := range map2 {
		if v1, ok := map1[k]; !ok {
			result[k] = v2
		} else {
			map1Inner, ok1 := v1.(map[interface{}]interface{})
			map2Inner, ok2 := v2.(map[interface{}]interface{})
			if ok1 && ok2 {
				result[k] = mergeMaps(map1Inner, map2Inner)
			} else {
				result[k] = v2
			}
		}
	}
	for k, v := range map1 {
		if v2, ok := map2[k]; !ok {
			result[k] = v
		} else {
			map1Inner, ok1 := v.(map[interface{}]interface{})
			map2Inner, ok2 := v2.(map[interface{}]interface{})
			if ok1 && ok2 {
				result[k] = mergeMaps(map1Inner, map2Inner)
			}
		}
	}
	return result
}
1098578
func (s *GetService) StoredFields(storedFields ...string) *GetService {
	s.storedFields = append(s.storedFields, storedFields...)
	return s
}