Class: JayAPI::Elasticsearch::QueryBuilder::Aggregations::ScriptedMetric
- Inherits:
-
Aggregation
- Object
- Aggregation
- JayAPI::Elasticsearch::QueryBuilder::Aggregations::ScriptedMetric
- Defined in:
- lib/jay_api/elasticsearch/query_builder/aggregations/scripted_metric.rb
Overview
Represents a scripted_metric
aggregation in Elasticsearch. Information about this type of aggregation can be found in: www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html
Instance Attribute Summary collapse
-
#combine_script ⇒ Object
readonly
Returns the value of attribute combine_script.
-
#init_script ⇒ Object
readonly
Returns the value of attribute init_script.
-
#map_script ⇒ Object
readonly
Returns the value of attribute map_script.
-
#reduce_script ⇒ Object
readonly
Returns the value of attribute reduce_script.
Attributes inherited from Aggregation
Instance Method Summary collapse
- #aggs ⇒ Object
-
#clone ⇒ self
A copy of the receiver.
-
#initialize(name, map_script:, combine_script:, reduce_script:, init_script: nil) ⇒ ScriptedMetric
constructor
A new instance of ScriptedMetric.
-
#to_h ⇒ Hash
The Hash representation of the
Aggregation
.
Constructor Details
#initialize(name, map_script:, combine_script:, reduce_script:, init_script: nil) ⇒ ScriptedMetric
Returns a new instance of ScriptedMetric.
30 31 32 33 34 35 36 37 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/scripted_metric.rb', line 30 def initialize(name, map_script:, combine_script:, reduce_script:, init_script: nil) super(name) @init_script = init_script @map_script = map_script @combine_script = combine_script @reduce_script = reduce_script end |
Instance Attribute Details
#combine_script ⇒ Object (readonly)
Returns the value of attribute combine_script.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/scripted_metric.rb', line 13 def combine_script @combine_script end |
#init_script ⇒ Object (readonly)
Returns the value of attribute init_script.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/scripted_metric.rb', line 13 def init_script @init_script end |
#map_script ⇒ Object (readonly)
Returns the value of attribute map_script.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/scripted_metric.rb', line 13 def map_script @map_script end |
#reduce_script ⇒ Object (readonly)
Returns the value of attribute reduce_script.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/scripted_metric.rb', line 13 def reduce_script @reduce_script end |
Instance Method Details
#aggs ⇒ Object
42 43 44 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/scripted_metric.rb', line 42 def aggs no_nested_aggregations('Scripted Metric') end |
#clone ⇒ self
Returns A copy of the receiver.
47 48 49 50 51 52 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/scripted_metric.rb', line 47 def clone self.class.new( name, map_script: map_script, combine_script: combine_script, reduce_script: reduce_script, init_script: init_script ) end |
#to_h ⇒ Hash
Returns The Hash representation of the Aggregation
. Properly formatted for Elasticsearch.
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/scripted_metric.rb', line 56 def to_h super do { scripted_metric: { init_script: init_script, map_script: map_script, combine_script: combine_script, reduce_script: reduce_script }.compact } end end |