Class: ElasticGraph::SchemaDefinition::Indexing::FieldType::Object Private
- Inherits:
-
Object
- Object
- ElasticGraph::SchemaDefinition::Indexing::FieldType::Object
- Defined in:
- elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/field_type/object.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 the mapping of a SchemaElements::ObjectType.
Instance Attribute Summary collapse
-
#mapping_options ⇒ Hash<String, ::Object>
readonly
Options to be included in the mapping.
-
#subfields ⇒ Array<Field>
readonly
The subfields of this object type.
-
#type_name ⇒ String
readonly
Name of the object type.
Instance Method Summary collapse
-
#to_mapping ⇒ Hash<String, ::Object>
private
The datastore mapping for this object type.
Instance Attribute Details
#mapping_options ⇒ Hash<String, ::Object> (readonly)
Returns options to be included in the mapping.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/field_type/object.rb', line 27 class Object < Support::MemoizableData.define(:schema_def_state, :type_name, :subfields, :mapping_options) # @return [Hash<String, ::Object>] the datastore mapping for this object type. def to_mapping @to_mapping ||= begin base_mapping = Field.normalized_mapping_hash_for(subfields) # When a custom mapping type is used, we need to omit `properties`, because custom mapping # types generally don't use `properties` (and if you need to use `properties` with a custom # type, you're responsible for defining the properties). base_mapping = base_mapping.except("properties") if ([:type] || "object") != "object" base_mapping.merge(Support::HashUtil.stringify_keys()) end end # @private def after_initialize subfields.freeze end end |
#subfields ⇒ Array<Field> (readonly)
Returns the subfields of this object type.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/field_type/object.rb', line 27 class Object < Support::MemoizableData.define(:schema_def_state, :type_name, :subfields, :mapping_options) # @return [Hash<String, ::Object>] the datastore mapping for this object type. def to_mapping @to_mapping ||= begin base_mapping = Field.normalized_mapping_hash_for(subfields) # When a custom mapping type is used, we need to omit `properties`, because custom mapping # types generally don't use `properties` (and if you need to use `properties` with a custom # type, you're responsible for defining the properties). base_mapping = base_mapping.except("properties") if ([:type] || "object") != "object" base_mapping.merge(Support::HashUtil.stringify_keys()) end end # @private def after_initialize subfields.freeze end end |
#type_name ⇒ String (readonly)
Returns name of the object type.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/field_type/object.rb', line 27 class Object < Support::MemoizableData.define(:schema_def_state, :type_name, :subfields, :mapping_options) # @return [Hash<String, ::Object>] the datastore mapping for this object type. def to_mapping @to_mapping ||= begin base_mapping = Field.normalized_mapping_hash_for(subfields) # When a custom mapping type is used, we need to omit `properties`, because custom mapping # types generally don't use `properties` (and if you need to use `properties` with a custom # type, you're responsible for defining the properties). base_mapping = base_mapping.except("properties") if ([:type] || "object") != "object" base_mapping.merge(Support::HashUtil.stringify_keys()) end end # @private def after_initialize subfields.freeze end end |
Instance Method Details
#to_mapping ⇒ Hash<String, ::Object>
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 the datastore mapping for this object type.
29 30 31 32 33 34 35 36 37 38 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/field_type/object.rb', line 29 def to_mapping @to_mapping ||= begin base_mapping = Field.normalized_mapping_hash_for(subfields) # When a custom mapping type is used, we need to omit `properties`, because custom mapping # types generally don't use `properties` (and if you need to use `properties` with a custom # type, you're responsible for defining the properties). base_mapping = base_mapping.except("properties") if ([:type] || "object") != "object" base_mapping.merge(Support::HashUtil.stringify_keys()) end end |