Skip to content

Commit

Permalink
Add ScriptFile to aggregations and Update API
Browse files Browse the repository at this point in the history
  • Loading branch information
olivere committed Mar 11, 2015
1 parent f445e14 commit 0a1d742
Show file tree
Hide file tree
Showing 19 changed files with 212 additions and 5 deletions.
9 changes: 9 additions & 0 deletions search_aggs_avg.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package elastic
type AvgAggregation struct {
field string
script string
scriptFile string
lang string
format string
params map[string]interface{}
Expand All @@ -37,6 +38,11 @@ func (a AvgAggregation) Script(script string) AvgAggregation {
return a
}

func (a AvgAggregation) ScriptFile(scriptFile string) AvgAggregation {
a.scriptFile = scriptFile
return a
}

func (a AvgAggregation) Lang(lang string) AvgAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -77,6 +83,9 @@ func (a AvgAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_cardinality.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package elastic
type CardinalityAggregation struct {
field string
script string
scriptFile string
lang string
format string
params map[string]interface{}
Expand All @@ -38,6 +39,11 @@ func (a CardinalityAggregation) Script(script string) CardinalityAggregation {
return a
}

func (a CardinalityAggregation) ScriptFile(scriptFile string) CardinalityAggregation {
a.scriptFile = scriptFile
return a
}

func (a CardinalityAggregation) Lang(lang string) CardinalityAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -90,6 +96,9 @@ func (a CardinalityAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_date_histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package elastic
type DateHistogramAggregation struct {
field string
script string
scriptFile string
lang string
params map[string]interface{}
subAggregations map[string]Aggregation
Expand Down Expand Up @@ -47,6 +48,11 @@ func (a DateHistogramAggregation) Script(script string) DateHistogramAggregation
return a
}

func (a DateHistogramAggregation) ScriptFile(scriptFile string) DateHistogramAggregation {
a.scriptFile = scriptFile
return a
}

func (a DateHistogramAggregation) Lang(lang string) DateHistogramAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -229,6 +235,9 @@ func (a DateHistogramAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_date_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
type DateRangeAggregation struct {
field string
script string
scriptFile string
lang string
params map[string]interface{}
subAggregations map[string]Aggregation
Expand Down Expand Up @@ -53,6 +54,11 @@ func (a DateRangeAggregation) Script(script string) DateRangeAggregation {
return a
}

func (a DateRangeAggregation) ScriptFile(scriptFile string) DateRangeAggregation {
a.scriptFile = scriptFile
return a
}

func (a DateRangeAggregation) Lang(lang string) DateRangeAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -174,6 +180,9 @@ func (a DateRangeAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_extended_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package elastic
type ExtendedStatsAggregation struct {
field string
script string
scriptFile string
lang string
format string
params map[string]interface{}
Expand All @@ -36,6 +37,11 @@ func (a ExtendedStatsAggregation) Script(script string) ExtendedStatsAggregation
return a
}

func (a ExtendedStatsAggregation) ScriptFile(scriptFile string) ExtendedStatsAggregation {
a.scriptFile = scriptFile
return a
}

func (a ExtendedStatsAggregation) Lang(lang string) ExtendedStatsAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -76,6 +82,9 @@ func (a ExtendedStatsAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_geo_bounds.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package elastic
type GeoBoundsAggregation struct {
field string
script string
scriptFile string
lang string
params map[string]interface{}
wrapLongitude *bool
Expand All @@ -30,6 +31,11 @@ func (a GeoBoundsAggregation) Script(script string) GeoBoundsAggregation {
return a
}

func (a GeoBoundsAggregation) ScriptFile(scriptFile string) GeoBoundsAggregation {
a.scriptFile = scriptFile
return a
}

func (a GeoBoundsAggregation) Lang(lang string) GeoBoundsAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -81,6 +87,9 @@ func (a GeoBoundsAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
6 changes: 6 additions & 0 deletions search_aggs_histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package elastic
type HistogramAggregation struct {
field string
script string
scriptFile string
lang string
params map[string]interface{}
subAggregations map[string]Aggregation
Expand Down Expand Up @@ -42,6 +43,11 @@ func (a HistogramAggregation) Script(script string) HistogramAggregation {
return a
}

func (a HistogramAggregation) ScriptFile(scriptFile string) HistogramAggregation {
a.scriptFile = scriptFile
return a
}

func (a HistogramAggregation) Lang(lang string) HistogramAggregation {
a.lang = lang
return a
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_max.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package elastic
type MaxAggregation struct {
field string
script string
scriptFile string
lang string
format string
params map[string]interface{}
Expand All @@ -37,6 +38,11 @@ func (a MaxAggregation) Script(script string) MaxAggregation {
return a
}

func (a MaxAggregation) ScriptFile(scriptFile string) MaxAggregation {
a.scriptFile = scriptFile
return a
}

func (a MaxAggregation) Lang(lang string) MaxAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -77,6 +83,9 @@ func (a MaxAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_min.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package elastic
type MinAggregation struct {
field string
script string
scriptFile string
lang string
format string
params map[string]interface{}
Expand All @@ -37,6 +38,11 @@ func (a MinAggregation) Script(script string) MinAggregation {
return a
}

func (a MinAggregation) ScriptFile(scriptFile string) MinAggregation {
a.scriptFile = scriptFile
return a
}

func (a MinAggregation) Lang(lang string) MinAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -77,6 +83,9 @@ func (a MinAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_percentile_ranks.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package elastic
type PercentileRanksAggregation struct {
field string
script string
scriptFile string
lang string
format string
params map[string]interface{}
Expand Down Expand Up @@ -37,6 +38,11 @@ func (a PercentileRanksAggregation) Script(script string) PercentileRanksAggrega
return a
}

func (a PercentileRanksAggregation) ScriptFile(scriptFile string) PercentileRanksAggregation {
a.scriptFile = scriptFile
return a
}

func (a PercentileRanksAggregation) Lang(lang string) PercentileRanksAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -100,6 +106,9 @@ func (a PercentileRanksAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_percentiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package elastic
type PercentilesAggregation struct {
field string
script string
scriptFile string
lang string
format string
params map[string]interface{}
Expand Down Expand Up @@ -37,6 +38,11 @@ func (a PercentilesAggregation) Script(script string) PercentilesAggregation {
return a
}

func (a PercentilesAggregation) ScriptFile(scriptFile string) PercentilesAggregation {
a.scriptFile = scriptFile
return a
}

func (a PercentilesAggregation) Lang(lang string) PercentilesAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -99,6 +105,9 @@ func (a PercentilesAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
type RangeAggregation struct {
field string
script string
scriptFile string
lang string
params map[string]interface{}
subAggregations map[string]Aggregation
Expand Down Expand Up @@ -51,6 +52,11 @@ func (a RangeAggregation) Script(script string) RangeAggregation {
return a
}

func (a RangeAggregation) ScriptFile(scriptFile string) RangeAggregation {
a.scriptFile = scriptFile
return a
}

func (a RangeAggregation) Lang(lang string) RangeAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -166,6 +172,9 @@ func (a RangeAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
9 changes: 9 additions & 0 deletions search_aggs_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package elastic
type StatsAggregation struct {
field string
script string
scriptFile string
lang string
format string
params map[string]interface{}
Expand All @@ -36,6 +37,11 @@ func (a StatsAggregation) Script(script string) StatsAggregation {
return a
}

func (a StatsAggregation) ScriptFile(scriptFile string) StatsAggregation {
a.scriptFile = scriptFile
return a
}

func (a StatsAggregation) Lang(lang string) StatsAggregation {
a.lang = lang
return a
Expand Down Expand Up @@ -76,6 +82,9 @@ func (a StatsAggregation) Source() interface{} {
if a.script != "" {
opts["script"] = a.script
}
if a.scriptFile != "" {
opts["script_file"] = a.scriptFile
}
if a.lang != "" {
opts["lang"] = a.lang
}
Expand Down
Loading

0 comments on commit 0a1d742

Please sign in to comment.