es_fields 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/Gemfile.lock +1 -1
 - data/README.md +3 -4
 - data/lib/es_fields/fields.rb +13 -2
 - data/lib/es_fields/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1c373c0fc35febd332ded68a98992142d08947fc53a5d72dd447fd8e6de927af
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 376184859485e660bd866fce86811c9211addfe96b13eea9d74fc2cbdbc0a7c8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0c8d8956b99259bae37f3e5fa124c0fc13f8a98b71c6af86757f89e5eedabd165528a1161ce16f2aa974ebf504c36ebb294073e0fa094711ad2444b1eeb65fb6
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: de2ac41dabb2ffc79369f6ad50b6cd11c43788bacdfa39a349f4d645c4241270fd8c92af8b0e079442c725dd61ee202b4ae1ba60925ee71a22653524b533ec9f
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -21,13 +21,12 @@ Or install it yourself as: 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
            ```ruby
         
     | 
| 
       23 
23 
     | 
    
         
             
              mapping do
         
     | 
| 
       24 
     | 
    
         
            -
                field :name, :string
         
     | 
| 
      
 24 
     | 
    
         
            +
                field :name, :string, options: [:full_text_search]
         
     | 
| 
       25 
25 
     | 
    
         
             
                field :age, :long
         
     | 
| 
       26 
     | 
    
         
            -
                field :email, : 
     | 
| 
      
 26 
     | 
    
         
            +
                field :email, :string, options: [:filtering]
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
       28 
28 
     | 
    
         
             
            ```
         
     | 
| 
       29 
     | 
    
         
            -
            This will  
     | 
| 
       30 
     | 
    
         
            -
            Hash which can be used with ElasticSearch API to add fields to an existing index.
         
     | 
| 
      
 29 
     | 
    
         
            +
            This will return a Hash which can be used with ElasticSearch API to add fields to an existing index.
         
     | 
| 
       31 
30 
     | 
    
         | 
| 
       32 
31 
     | 
    
         
             
            ## Development
         
     | 
| 
       33 
32 
     | 
    
         | 
    
        data/lib/es_fields/fields.rb
    CHANGED
    
    | 
         @@ -19,13 +19,24 @@ class Fields 
     | 
|
| 
       19 
19 
     | 
    
         
             
                ip: 'ip',
         
     | 
| 
       20 
20 
     | 
    
         
             
              }
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
      
 22 
     | 
    
         
            +
              OPTIONS_MAPPING = {
         
     | 
| 
      
 23 
     | 
    
         
            +
                sortable: 'keyword',
         
     | 
| 
      
 24 
     | 
    
         
            +
                full_text_search: 'text',
         
     | 
| 
      
 25 
     | 
    
         
            +
                aggregation: 'keyword',
         
     | 
| 
      
 26 
     | 
    
         
            +
                filtering: 'keyword',
         
     | 
| 
      
 27 
     | 
    
         
            +
              }
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
       22 
29 
     | 
    
         
             
              def initialize
         
     | 
| 
       23 
30 
     | 
    
         
             
                @base_mapping = BASE_MAPPING.dup
         
     | 
| 
       24 
31 
     | 
    
         
             
              end
         
     | 
| 
       25 
32 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
              def field(name, type)
         
     | 
| 
      
 33 
     | 
    
         
            +
              def field(name, type, options: [])
         
     | 
| 
       27 
34 
     | 
    
         
             
                @base_mapping[:mappings][:doc][:properties].merge!(
         
     | 
| 
       28 
     | 
    
         
            -
                  { 
     | 
| 
      
 35 
     | 
    
         
            +
                  {
         
     | 
| 
      
 36 
     | 
    
         
            +
                    name => {
         
     | 
| 
      
 37 
     | 
    
         
            +
                      type: options.empty? ? TYPE_MAPPING[type] : OPTIONS_MAPPING[options.first]
         
     | 
| 
      
 38 
     | 
    
         
            +
                    }
         
     | 
| 
      
 39 
     | 
    
         
            +
                  }
         
     | 
| 
       29 
40 
     | 
    
         
             
                )
         
     | 
| 
       30 
41 
     | 
    
         
             
                @base_mapping
         
     | 
| 
       31 
42 
     | 
    
         
             
              end
         
     | 
    
        data/lib/es_fields/version.rb
    CHANGED