Class ScriptedMetricAggregation.Builder
java.lang.Object
co.elastic.clients.util.ObjectBuilderBase
co.elastic.clients.util.WithJsonObjectBuilderBase<BuilderT>
co.elastic.clients.elasticsearch._types.aggregations.MetricAggregationBase.AbstractBuilder<ScriptedMetricAggregation.Builder>
co.elastic.clients.elasticsearch._types.aggregations.ScriptedMetricAggregation.Builder
- All Implemented Interfaces:
WithJson<ScriptedMetricAggregation.Builder>,ObjectBuilder<ScriptedMetricAggregation>
- Enclosing class:
- ScriptedMetricAggregation
public static class ScriptedMetricAggregation.Builder
extends MetricAggregationBase.AbstractBuilder<ScriptedMetricAggregation.Builder>
implements ObjectBuilder<ScriptedMetricAggregation>
Builder for
ScriptedMetricAggregation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aScriptedMetricAggregation.combineScript(Script value) Runs once on each shard after document collection is complete.Runs once on each shard after document collection is complete.initScript(Script value) Runs prior to any collection of documents.Runs prior to any collection of documents.Run once per document collected.Run once per document collected.A global object with script parameters forinit,mapandcombinescripts.A global object with script parameters forinit,mapandcombinescripts.reduceScript(Script value) Runs once on the coordinating node after all shards have returned their results.Runs once on the coordinating node after all shards have returned their results.protected ScriptedMetricAggregation.Builderself()Methods inherited from class co.elastic.clients.elasticsearch._types.aggregations.MetricAggregationBase.AbstractBuilder
field, missing, missing, missing, missing, missing, missing, script, scriptMethods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBase
withJsonMethods inherited from class co.elastic.clients.util.ObjectBuilderBase
_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
combineScript
Runs once on each shard after document collection is complete. Allows the aggregation to consolidate the state returned from each shard.API name:
combine_script -
combineScript
public final ScriptedMetricAggregation.Builder combineScript(Function<Script.Builder, ObjectBuilder<Script>> fn) Runs once on each shard after document collection is complete. Allows the aggregation to consolidate the state returned from each shard.API name:
combine_script -
initScript
Runs prior to any collection of documents. Allows the aggregation to set up any initial state.API name:
init_script -
initScript
public final ScriptedMetricAggregation.Builder initScript(Function<Script.Builder, ObjectBuilder<Script>> fn) Runs prior to any collection of documents. Allows the aggregation to set up any initial state.API name:
init_script -
mapScript
Run once per document collected. If nocombine_scriptis specified, the resulting state needs to be stored in thestateobject.API name:
map_script -
mapScript
public final ScriptedMetricAggregation.Builder mapScript(Function<Script.Builder, ObjectBuilder<Script>> fn) Run once per document collected. If nocombine_scriptis specified, the resulting state needs to be stored in thestateobject.API name:
map_script -
params
A global object with script parameters forinit,mapandcombinescripts. It is shared between the scripts.API name:
paramsAdds all entries of
maptoparams. -
params
A global object with script parameters forinit,mapandcombinescripts. It is shared between the scripts.API name:
paramsAdds an entry to
params. -
reduceScript
Runs once on the coordinating node after all shards have returned their results. The script is provided with access to a variablestates, which is an array of the result of thecombine_scripton each shard.API name:
reduce_script -
reduceScript
public final ScriptedMetricAggregation.Builder reduceScript(Function<Script.Builder, ObjectBuilder<Script>> fn) Runs once on the coordinating node after all shards have returned their results. The script is provided with access to a variablestates, which is an array of the result of thecombine_scripton each shard.API name:
reduce_script -
self
- Specified by:
selfin classMetricAggregationBase.AbstractBuilder<ScriptedMetricAggregation.Builder>
-
build
Builds aScriptedMetricAggregation.- Specified by:
buildin interfaceObjectBuilder<ScriptedMetricAggregation>- Throws:
NullPointerException- if some of the required fields are null.
-