Module: ElasticGraph::Warehouse::SchemaDefinition::IndexExtension

Defined in:
elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/index_extension.rb

Overview

Extends SchemaDefinition::Indexing::Index to add warehouse table definition support.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#warehouse_table_defWarehouseTable? (readonly)

Returns the warehouse table definition for this index, if one has been defined via #warehouse_table.

Returns:

  • (WarehouseTable, nil)

    the warehouse table definition, or nil if none has been defined



20
21
22
# File 'elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/index_extension.rb', line 20

def warehouse_table_def
  @warehouse_table_def
end

Instance Method Details

#warehouse_table(name) ⇒ void

This method returns an undefined value.

Defines a warehouse table for this index.

Examples:

Define a warehouse table for the products index

ElasticGraph.define_schema do |schema|
  schema.object_type "Product" do |t|
    t.field "id", "ID"
    t.field "name", "String"

    t.index "products" do |i|
      i.warehouse_table "store_products"
    end
  end
end

Parameters:

  • name (String)

    name of the warehouse table



38
39
40
# File 'elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/index_extension.rb', line 38

def warehouse_table(name)
  @warehouse_table_def = WarehouseTable.new(name: name, index: self)
end