Class: Esse::ClusterEngine

Inherits:
Object
  • Object
show all
Defined in:
lib/esse/cluster_engine.rb

Constant Summary collapse

OPENSEARCH_FORK_VERSION =
'7.10.2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(distribution:, version:) ⇒ ClusterEngine

Returns a new instance of ClusterEngine.



9
10
11
12
# File 'lib/esse/cluster_engine.rb', line 9

def initialize(distribution:, version:)
  @distribution = distribution
  @version = version
end

Instance Attribute Details

#distributionObject (readonly)

Returns the value of attribute distribution.



7
8
9
# File 'lib/esse/cluster_engine.rb', line 7

def distribution
  @distribution
end

#versionObject (readonly)

Returns the value of attribute version.



7
8
9
# File 'lib/esse/cluster_engine.rb', line 7

def version
  @version
end

Instance Method Details

#elasticsearch?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/esse/cluster_engine.rb', line 24

def elasticsearch?
  distribution == 'elasticsearch'
end

#engine_versionObject



14
15
16
17
18
# File 'lib/esse/cluster_engine.rb', line 14

def engine_version
  return @version unless opensearch?

  OPENSEARCH_FORK_VERSION
end

#mapping_default_typeObject



36
37
38
39
40
# File 'lib/esse/cluster_engine.rb', line 36

def mapping_default_type
  return unless engine_version.to_i == 6

  engine_version >= '6.4' ? :_doc : :doc
end

#mapping_single_type?Boolean



29
30
31
# File 'lib/esse/cluster_engine.rb', line 29

def mapping_single_type?
  engine_version >= '6'
end

#opensearch?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/esse/cluster_engine.rb', line 20

def opensearch?
  distribution == 'opensearch'
end