Elasticsearch and multilanguage attributes

Hi,

I m using rails and elasticsearch. My object "product" have a title and a
text in different language and also a price and a category

here what im currently doing. it is working, but very slow

mapping do
indexes :id, type: 'integer', :index => :not_analyzed
indexes :sousrubrique_id, type: 'integer', :index => :not_analyzed
indexes :price, type: 'float', :index => :not_analyzed

Language.get_mapping_langues.each  do |idl, value|
  class_eval <<-RUBY
    indexes :title_#{value}, :as => lambda { |product| 

product.attributes['title_' + value] unless
product.attributes['date_validation_' + value].nil? }
indexes :text_#{value}, :as => lambda { |product|
product.attributes['text_' + value] unless
product.attributes['date_validation_' + value].nil?}
RUBY
end
end


tire.search(:page => (prms[:page] || 1)) do
  query do
    filtered {
      query { string mc} unless mc.blank?
      filter :term, :sousrubrique_id => prms[:sousrubrique_id] unless 

prms[:sousrubrique_id].blank?
filter :range, {:prix_local_objet => {:from =>
prms[:price][:max], :to => prms[:price][:min]}}
}
end
end

but when I make a search, then it will search in all language, when
actually I would like only for the current language, which should be
quicklier.

is there a way to do that ? Or should I create one index for each language
? But if such, how to tell which index to use for callback when I delete or
edit or create a product ?

thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.