vendredi 6 mai 2016

Elesticsearch and Emberjs

I'm very new to EmberJS, and trying to wire it with ElasticSearch. So far, I've read most of the Ember documentation, and found out this adapter for ElasticSearch.

The problem is I can't figure out how to use it (i.e. configure it so that when I call store.save(), my model is sent to ES.

What I have ATM is a newly created project with Ember generator (ember new ), and a generated controller, router, model, etc. My problem is that the Ember document explains how to customise adapters, but not how to use them (or I missed that part). The ES adapter's documentation says :

var App = Em.Application.create();

App.store = DS.Store.create({
  revision: 4,
  adapter: DS.ElasticSearchAdapter.create({url: 'http://localhost:9200'})
});

which implies to create a Store, whereas I can only see ways to extend it in the Ember documentation. Furthermore, I already have a Store in my application.

So the questions are:

  • do I need to override the store creation to replace it with the ES one (and where to do that) OR
  • do I need to extend the existing one, and in this case, how should I do that ?

Also, when it says:

First, load the ember-data/lib/adapters/elasticsearch_adapter.js file in your application.

where and how that should be done ?

Thanks for your kind help




Aucun commentaire:

Enregistrer un commentaire