matteodem / meteor-easy-search

Easy-to-use search for Meteor with Blaze Components
MIT License
435 stars 68 forks source link

Elasticsearch configure indexname / multiple indexes #530

Open steven-tib opened 8 years ago

steven-tib commented 8 years ago

Hi @matteodem, I'm currently using easysearch with elasticsearch engine and I'm facing some limitations because of the hardcoded index "easysearch".

from your lib/engine.js in elasticsearch package : ` onIndexCreate(indexConfig) { super.onIndexCreate(indexConfig);

if (Meteor.isServer) {
  indexConfig.elasticSearchClient = new elasticsearch.Client(this.config.client);
  indexConfig.elasticSearchSyncer = new ElasticSearchDataSyncer({
    indexName: 'easysearch',
    indexType: indexConfig.name,
    collection: indexConfig.collection,
    client: indexConfig.elasticSearchClient,
    beforeIndex: (doc) => this.callConfigMethod('getElasticSearchDoc', doc, this.callConfigMethod('fieldsToIndex', indexConfig))
  });
}

} `

Could it be possible to have it accessible and modifiable through the config options, the same way the indexType is possible to setup ?

It would help a lot with my app architecture as the mappings may change a lot during its evolution, having only one index would result in very complicated reindexing tasks. It would be the same issue if the number of shards would have to be modified.

Else is there another solution ? maybe by using aliases .. ? Thanks for your reply.

matteodem commented 7 years ago

sure, a PR would be great here. I can give you pointers if that's fine.