Sha256: d838f475d0d860c0cfa0e85483fb8d547913e8dba7acdd6f705103e1cede5a89

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Esse
  class ClusterEngine
    OPENSEARCH_FORK_VERSION = '7.10.2'

    attr_reader :version, :distribution

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

    def engine_version
      return @version unless opensearch?

      OPENSEARCH_FORK_VERSION
    end

    def opensearch?
      distribution == 'opensearch'
    end

    def elasticsearch?
      distribution == 'elasticsearch'
    end

    # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.17/removal-of-types.html
    def mapping_single_type?
      engine_version >= '6'
    end

    # @see https://www.elastic.co/guide/en/elasticsearch/reference/6.3/mapping.html
    # @see https://www.elastic.co/guide/en/elasticsearch/reference/6.4/mapping.html
    # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.1/mapping.html
    def mapping_default_type
      return unless engine_version.to_i == 6

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
esse-0.4.0.rc4 lib/esse/cluster_engine.rb
esse-0.4.0.rc3 lib/esse/cluster_engine.rb
esse-0.4.0.rc2 lib/esse/cluster_engine.rb
esse-0.4.0.rc1 lib/esse/cluster_engine.rb
esse-0.3.5 lib/esse/cluster_engine.rb
esse-0.3.4 lib/esse/cluster_engine.rb
esse-0.3.3 lib/esse/cluster_engine.rb
esse-0.3.2 lib/esse/cluster_engine.rb
esse-0.3.1 lib/esse/cluster_engine.rb
esse-0.3.0 lib/esse/cluster_engine.rb
esse-0.2.6 lib/esse/cluster_engine.rb
esse-0.2.5 lib/esse/cluster_engine.rb
esse-0.2.4 lib/esse/cluster_engine.rb
esse-0.2.3 lib/esse/cluster_engine.rb
esse-0.2.2 lib/esse/cluster_engine.rb