Module: ElasticRecord::Index::Mapping

Included in:
ElasticRecord::Index
Defined in:
lib/elastic_record/index/mapping.rb

Instance Method Summary collapse

Instance Method Details

#mappingObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/elastic_record/index/mapping.rb', line 8

def mapping
  @mapping ||= {
    _source: {
      enabled: false
    },
    properties: {
      created_at: {type: "date", index: "not_analyzed", format: "dateOptionalTime"},
      updated_at: {type: "date", index: "not_analyzed", format: "dateOptionalTime"}
    },
    dynamic_templates: [
      {
        no_string_analyzing: {
          match: "*",
          match_mapping_type: "string",
          mapping: {
            type: "string",
            index: "not_analyzed"
          }
        }
      }
    ]
  }
end

#mapping=(mapping) ⇒ Object



4
5
6
# File 'lib/elastic_record/index/mapping.rb', line 4

def mapping=(mapping)
  mapping.deep_merge!(mapping)
end