Class: ROM::Elasticsearch::Schema

Inherits:
Schema
  • Object
show all
Defined in:
lib/rom/elasticsearch/schema.rb

Overview

Elasticsearch relation schema

Instance Method Summary collapse

Instance Method Details

#to_output_hashObject

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.

Customized output hash constructor which symbolizes keys and optionally applies custom read-type coercions



23
24
25
26
27
# File 'lib/rom/elasticsearch/schema.rb', line 23

def to_output_hash
  Types::Hash
    .schema(map { |attr| [attr.key, attr.to_read_type] }.to_h)
    .with_key_transform(&:to_sym)
end

#to_propertiesObject

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.

Return a hash with mapping properties



15
16
17
# File 'lib/rom/elasticsearch/schema.rb', line 15

def to_properties
  select(&:properties?).map { |attr| [attr.name, attr.properties] }.to_h
end