<commit_before>module ElasticRecord
  class Index
    module Mapping
      def mapping=(custom_mapping)
        mapping.deep_merge!(custom_mapping)
      end

      def update_mapping(index_name = alias_name)
        connection.json_put "/#{index_name}/#{type}/_mapping", type => mapping
      end

      def get_mapping(index_name = alias_name)
        json = connection.json_get "/#{index_name}/#{type}/_mapping"
        unless json.empty?
          json.values.first['mappings']
        end
      end

      def delete_mapping(index_name = alias_name)
        connection.json_delete "/#{index_name}/#{type}"
      end

      def mapping
        @mapping ||= {
          properties: {
            created_at: {type: "date", index: "not_analyzed", format: "dateOptionalTime"},
            updated_at: {type: "date", index: "not_analyzed", format: "dateOptionalTime"}
          },
          _all: {
            enabled: false<commit_msg>Remove created_at and updated_at from default index mapping<commit_after>module ElasticRecord
  class Index
    module Mapping
      def mapping=(custom_mapping)
        mapping.deep_merge!(custom_mapping)
      end

      def update_mapping(index_name = alias_name)
        connection.json_put "/#{index_name}/#{type}/_mapping", type => mapping
      end

      def get_mapping(index_name = alias_name)
        json = connection.json_get "/#{index_name}/#{type}/_mapping"
        unless json.empty?
          json.values.first['mappings']
        end
      end

      def delete_mapping(index_name = alias_name)
        connection.json_delete "/#{index_name}/#{type}"
      end

      def mapping
        @mapping ||= {
          properties: {
          },
          _all: {
            enabled: false
{'fraction_non_alphanumeric': 0.10638297872340426, 'fraction_numerical': 0.0, 'mean_word_length': 2.3333333333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2630070', 'n_tokens_mistral': 492, 'n_tokens_neox': 495, 'n_words': 104}