Class: ElasticGraph::SchemaDefinition::Indexing::DerivedFields::ImmutableValue Private

Inherits:
Object
  • Object
show all
Defined in:
elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/derived_fields/immutable_value.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Responsible for providing bits of the painless script specific to a ElasticGraph::SchemaDefinition::Indexing::DerivedIndexedType#immutable_value field.

Instance Method Summary collapse

Instance Method Details

#apply_operation_returning_update_statusString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a line of painless code to manage an immutable value field and return a boolean indicating if it was updated.

Returns:

  • (String)

    a line of painless code to manage an immutable value field and return a boolean indicating if it was updated.



21
22
23
24
25
26
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/derived_fields/immutable_value.rb', line 21

def apply_operation_returning_update_status
  *parent_parts, field = destination_field.split(".")
  parent_parts = ["ctx", "_source"] + parent_parts

  %{immutableValue_idempotentlyUpdateValue(scriptErrors, data["#{source_field}"], #{parent_parts.join(".")}, "#{destination_field}", "#{field}", #{nullable}, #{can_change_from_null})}
end

#function_definitionsArray<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns painless functions required by immutable_value.

Returns:

  • (Array<String>)

    painless functions required by immutable_value.



34
35
36
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/derived_fields/immutable_value.rb', line 34

def function_definitions
  [IDEMPOTENTLY_SET_VALUE]
end

#setup_statementsArray<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a list of painless statements that must be called at the top of the script to set things up.

Returns:

  • (Array<String>)

    a list of painless statements that must be called at the top of the script to set things up.



29
30
31
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/derived_fields/immutable_value.rb', line 29

def setup_statements
  FieldInitializerSupport.build_empty_value_initializers(destination_field, leaf_value: :leave_unset)
end