Class: Elasticsearch::API::Response::Description

Inherits:
Object
  • Object
show all
Defined in:
lib/elasticsearch/api/response/description.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw:, type:, operator:, operation: nil, field: nil, value: nil) ⇒ Description

Returns a new instance of Description.



7
8
9
10
11
12
13
14
# File 'lib/elasticsearch/api/response/description.rb', line 7

def initialize(raw:, type:, operator:, operation: nil, field: nil, value: nil)
  @raw = raw
  @type = type
  @operator = operator
  @operation = operation
  @field = field
  @value = value
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



5
6
7
# File 'lib/elasticsearch/api/response/description.rb', line 5

def field
  @field
end

#operationObject (readonly)

Returns the value of attribute operation.



5
6
7
# File 'lib/elasticsearch/api/response/description.rb', line 5

def operation
  @operation
end

#operatorObject (readonly)

Returns the value of attribute operator.



5
6
7
# File 'lib/elasticsearch/api/response/description.rb', line 5

def operator
  @operator
end

#rawObject (readonly)

Returns the value of attribute raw.



5
6
7
# File 'lib/elasticsearch/api/response/description.rb', line 5

def raw
  @raw
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/elasticsearch/api/response/description.rb', line 5

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/elasticsearch/api/response/description.rb', line 5

def value
  @value
end

Instance Method Details

#as_jsonObject



16
17
18
19
20
21
22
23
24
# File 'lib/elasticsearch/api/response/description.rb', line 16

def as_json
  {
    type: type,
    operator: operator,
    operation: operation,
    field: field,
    value: value
  }.delete_if { |k, v| v.nil? }
end