-
Notifications
You must be signed in to change notification settings - Fork 804
Closed
Description
What
Under the circumstance that there is no index created yet when you save a model, the client(?) is smart enough to create the index automatically, but it's not respecting the number_of_shards setting
provided for the index.
If I create the index first, before saving the model by invoking PageText.gateway.create_index!
it will respect the setting and 3
shards will be created.
Example Model
class PageText
include Elasticsearch::Persistence::Model
index_name "page_texts-sv"
settings number_of_shards: 3
attribute :issue_id, Integer
attribute :content, String, default: "", mapping: { analyzer: 'swedish' }
end
With index created first
PageText.gateway.create_index!
PageText.create(issue_id: 123, content: "Here's my content.")
# ElasticSearch log output:
# elasticsearch_1 | [2017-03-02T12:18:29,667][INFO ][o.e.c.m.MetaDataCreateIndexService] [fiYQ9r5] [page_texts-sv] creating index, cause [api], templates [], shards [3]/[1], mappings [page_text]
With index automatically created
PageText.gateway.delete_index!
PageText.create(issue_id: 123, content: "Here's my content.")
# ElasticSearch log output:
# elasticsearch_1 | [2017-03-02T12:18:29,667][INFO ][o.e.c.m.MetaDataCreateIndexService] [fiYQ9r5] [page_texts-sv] creating index, cause [api], templates [], shards [5]/[1], mappings [page_text]
Metadata
Metadata
Assignees
Labels
No labels