Class: LogStash::Inputs::Elasticsearch::ColumnSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/inputs/elasticsearch/esql.rb

Overview

Class representing a column specification in the ESQL response The class’s main purpose is to provide a structure for the event key columns is an array with ‘name` and `type` pair (example: `“type”=>“date”`)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec) ⇒ ColumnSpec

Returns a new instance of ColumnSpec.



137
138
139
140
# File 'lib/logstash/inputs/elasticsearch/esql.rb', line 137

def initialize(spec)
  @name = isolate(spec.fetch('name'))
  @type = isolate(spec.fetch('type'))
end

Instance Attribute Details

#:nameString (readonly)

The name of the column

Returns:

  • (String)

    the current value of :name



134
135
136
# File 'lib/logstash/inputs/elasticsearch/esql.rb', line 134

def :name
  @:name
end

#:typeString (readonly)

The type of the column

Returns:

  • (String)

    the current value of :type



134
135
136
# File 'lib/logstash/inputs/elasticsearch/esql.rb', line 134

def :type
  @:type
end

#nameObject (readonly)

Returns the value of attribute name.



135
136
137
# File 'lib/logstash/inputs/elasticsearch/esql.rb', line 135

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



135
136
137
# File 'lib/logstash/inputs/elasticsearch/esql.rb', line 135

def type
  @type
end

Instance Method Details

#field_referenceObject



142
143
144
# File 'lib/logstash/inputs/elasticsearch/esql.rb', line 142

def field_reference
  @_field_reference ||= '[' + name.gsub('.', '][') + ']'
end