diff --git a/README.md b/README.md index 346b23d27..0a1ce2711 100644 --- a/README.md +++ b/README.md @@ -354,7 +354,7 @@ To define a multi field you have to specify any type except for `object` or `nes ```ruby field :full_name, type: 'text', value: ->{ full_name.strip } do field :ordered, analyzer: 'ordered' - field :untouched, index: 'not_analyzed' + field :untouched, type: 'keyword' end ``` diff --git a/lib/chewy/fields/base.rb b/lib/chewy/fields/base.rb index 818aa4d04..047f6c39a 100644 --- a/lib/chewy/fields/base.rb +++ b/lib/chewy/fields/base.rb @@ -34,12 +34,6 @@ def mappings_hash mapping.reverse_merge!(options) mapping.reverse_merge!(type: (children.present? ? 'object' : Chewy.default_field_type)) - # This is done to support ES2 journaling and will be removed soon - if mapping[:type] == 'keyword' && Chewy::Runtime.version < '5.0' - mapping[:type] = 'string' - mapping[:index] = 'not_analyzed' - end - {name => mapping} end diff --git a/spec/chewy/search_spec.rb b/spec/chewy/search_spec.rb index 005e7f11d..8972e47a2 100644 --- a/spec/chewy/search_spec.rb +++ b/spec/chewy/search_spec.rb @@ -71,12 +71,12 @@ def self.by_index(index) filter { match name: "Name#{index}" } end - field :name, **KEYWORD_FIELD + field :name, type: 'keyword' field :rating, type: :integer end define_type Country do - field :name, **KEYWORD_FIELD + field :name, type: 'keyword' field :rating, type: :integer end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 04199b217..153b1a926 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -33,15 +33,8 @@ } } -Chewy.default_field_type = 'string' if Chewy::Runtime.version < '5.0' # Chewy.transport_logger = Logger.new(STDERR) -KEYWORD_FIELD = if Chewy::Runtime.version < '5.0' - {type: 'string', index: 'not_analyzed'} -else - {type: 'keyword'} -end - RSpec.configure do |config| config.mock_with :rspec config.order = :random