Rails and ElasticSearch. How to create 2 indices with one model?

Hi,

Sorry for snuking into your group but I am compltely stuck with
ElasticSearch and I need help :slight_smile:

I am developping with ROR and the ES Gem.

class Post < ActiveRecord::Base
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks

Here is my ROR model, anyway...

def self.search(query)
      __elasticsearch__.search(

How can I specify wich index I want this function to search in ??
{
query:
here is a complex query
}
)
end

  index_name  "index_post_search" (I need another index...how can I do 

?)

  settings index_post_search: { number_of_shards: 1 } do  How can I and 

another setting to this model ?
mappings dynamic: 'false' do
indexes :title, analyzer: 'english', index_options:
'offsets'
indexes :content, analyzer: 'english'
end
end
end

How can I create and update another index ?

Post.elasticsearch.client.indices.delete index: "index_post_search"
rescue nil
Post.elasticsearch.client.indices.create index: "index_post_search",
body: { settings: Post.settings.to_hash, mappings: Post.mappings.to_hash }
Post.import

Thk U for your attention !!

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/62b8c4e5-7fb8-4e85-b286-6e91cb36ffe6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.