/
fieldDataFrequencyFilter.go
90 lines (83 loc) · 3.87 KB
/
fieldDataFrequencyFilter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package mapping
// FieldDataFrequencyFilter is utilized with mappings
type FieldDataFrequencyFilter struct {
Min float32 `bson:"min" json:"min"`
Max float32 `bson:"max" json:"max"`
MinSegmentSize int `bson:"min_segment_size" json:"min_segment_size"`
}
func (fdf *FieldDataFrequencyFilter) Clone() *FieldDataFrequencyFilter {
if fdf == nil {
return nil
}
res := *fdf
return &res
}
// WithFieldDataFrequencyFilter is a mapping with the
// field_data_frequency_filter
//
// FieldDataFrequencyFilter is an expert settings which allow to decide which
// values to load in memory when fielddata is enabled. By default all values are
// loaded.
//
// FieldData filtering can be used to reduce the number of terms loaded into
// memory, and thus reduce memory usage. Terms can be filtered by frequency:
//
// The frequency filter allows you to only load terms whose document frequency
// falls between a min and max value, which can be expressed an absolute number
// (when the number is bigger than 1.0) or as a percentage (eg 0.01 is 1% and
// 1.0 is 100%). Frequency is calculated per segment. Percentages are based on
// the number of docs which have a value for the field, as opposed to all docs
// in the segment.
//
// Small segments can be excluded completely by specifying the minimum number of
// docs that the segment should contain with min_segment_size
//
// https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#field-data-filtering
type WithFieldDataFrequencyFilter interface {
// FieldDataFrequencyFilter can be used to reduce the number of terms loaded
// into memory, and thus reduce memory usage when using FieldData filtering.
FieldDataFrequencyFilter() *FieldDataFrequencyFilter
// SetFieldDataFrequencyFilter sets the FieldDataFrequencyFilter value to v
SetFieldDataFrequencyFilter(v *FieldDataFrequencyFilter)
}
// FieldWithFieldDataFrequencyFilter is a Field with a FieldDataFrequencyFilter
// param
//
// https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#field-data-filtering
type FieldWithFieldDataFrequencyFilter interface {
Field
WithFieldDataFrequencyFilter
}
// FieldDataFrequencyFilterParam is a mixin that adds the
// field_data_frequency_filter param
//
// FieldDataFrequencyFilter is an expert settings which allow to decide which
// values to load in memory when fielddata is enabled. By default all values are
// loaded.
//
// FieldData filtering can be used to reduce the number of terms loaded into
// memory, and thus reduce memory usage. Terms can be filtered by frequency:
//
// The frequency filter allows you to only load terms whose document frequency
// falls between a min and max value, which can be expressed an absolute number
// (when the number is bigger than 1.0) or as a percentage (eg 0.01 is 1% and
// 1.0 is 100%). Frequency is calculated per segment. Percentages are based on
// the number of docs which have a value for the field, as opposed to all docs
// in the segment.
//
// Small segments can be excluded completely by specifying the minimum number of
// docs that the segment should contain with min_segment_size
//
// https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#field-data-filtering
type FieldDataFrequencyFilterParam struct {
FieldDataFrequencyFilterValue *FieldDataFrequencyFilter `bson:"fielddata_frequency_filter,omitempty" json:"fielddata_frequency_filter,omitempty"`
}
// FieldDataFrequencyFilter can be used to reduce the number of terms loaded into memory, and
// thus reduce memory usage when using FieldData filtering.
func (fd FieldDataFrequencyFilterParam) FieldDataFrequencyFilter() *FieldDataFrequencyFilter {
return fd.FieldDataFrequencyFilterValue
}
// SetFieldDataFrequencyFilter sets the FieldDataFrequencyFilter value to v
func (fd *FieldDataFrequencyFilterParam) SetFieldDataFrequencyFilter(v *FieldDataFrequencyFilter) {
fd.FieldDataFrequencyFilterValue = v
}