Commit 5b454a99aca57ccc22437a9fefeef632dae04162

Authored by Andrew Kane
1 parent 182fefbc

Use navigation notation to prevent name conflicts

lib/searchkick/reindex.rb
... ... @@ -118,10 +118,11 @@ module Searchkick
118 118 match: "*",
119 119 match_mapping_type: "string",
120 120 mapping: {
  121 + # http://www.elasticsearch.org/guide/reference/mapping/multi-field-type/
121 122 type: "multi_field",
122 123 fields: {
123   - "{name}_analyzed" => {type: "string", index: "analyzed"},
124   - "{name}" => {type: "string", index: "not_analyzed"}
  124 + "{name}" => {type: "string", index: "not_analyzed"},
  125 + "analyzed" => {type: "string", index: "analyzed"}
125 126 }
126 127 }
127 128 }
... ...
lib/searchkick/search.rb
... ... @@ -3,7 +3,7 @@ module Searchkick
3 3  
4 4 def search(term, options = {})
5 5 term = term.to_s
6   - fields = options[:fields] ? options[:fields].map{|f| "#{f}_analyzed" } : ["_all"]
  6 + fields = options[:fields] ? options[:fields].map{|f| "#{f}.analyzed" } : ["_all"]
7 7 operator = options[:partial] ? "or" : "and"
8 8 load = options[:load].nil? ? true : options[:load]
9 9 load = (options[:include] || true) if load
... ...