Class: ElasticAdapter::DocumentType

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_adapter/document_type.rb

Overview

This class is intended to hold information about a document in an elasticsearch index

Examples:

document_type = ElasticAdatper::DocumentType.new("test_doc", {
  test_doc: {
    properties: {
      name: {
        type: "string"
      }
    }
  }
})

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, mappings) ⇒ DocumentType

Returns a new instance of DocumentType.

Parameters:

  • name (String)
  • mappings (Hash)


26
27
28
29
# File 'lib/elastic_adapter/document_type.rb', line 26

def initialize(name, mappings)
  @name = name
  @mappings = mappings
end

Instance Attribute Details

#mappingsHash (readonly)

the mappings for the document

Returns:

  • (Hash)

    the current value of mappings



21
22
23
# File 'lib/elastic_adapter/document_type.rb', line 21

def mappings
  @mappings
end

#nameString (readonly)

the name of the document

Returns:

  • (String)

    the current value of name



21
22
23
# File 'lib/elastic_adapter/document_type.rb', line 21

def name
  @name
end