Looking for example on how to integrate Ember with Elastic search


Hello, Is there anybody having experience in integrating Ember with Elastic search ? Is data returned by Elastic search handled via Ember data or via a specific adapter ?


We do use elastic search. The search results returned will be translated into transport objects to serve the client code.


I am looking for the same thing. Although I have for the same object (a user) also a backend endpoint and want to use elastica only for searching.

@Jun_Andrew_Hu : could you maybe share some code how you did it?


Actually there is nothing special with the call. It is a regular REST api to fetch objects. But these REST apis are powered by elastic search.

Do you want to call elastic search directly?


Yes, I have a PHP Backend, which does not have the absolutely best performance. It scales quite well for regular purposes but I am trying to implement some kind of fulltext search for users. Meaning searching the users FirstName / LastName, nickname etc. I have an hosted elasticsearch and want my frontend to call it directly instead of calling my backend and my backend is calling elasticsearch.

I have found several tools that are trying to adress this (e.g. typeahead.js), but they are constructing queries via queryparameter. And the elasticsearch api seems to need the parameter in the payload.


We’re half way through a prototype ElasticSearchAdapter for Ember Data (upgrade to @karmi’s) that’s using the native elasticsearch-js client. It’s actually not that hard to build yourself. We’ll probably release it soon for general public consumption but I’d like some tests to wrap the little bits we do have now.


Sounds very interesting, I have to think if this might be an overkill for my use case (only the user search, since the acutal users are coming from the backend). But I will definately have a look at it.


One of the keys we found when doing search is having a “search-specific” version of the models that we instantiate when the search result data come back.

That is, instead of creating a User or Article from a search result, you create a SearchUser or SearchArticle. Search tends to create and throw away lots of objects. Your full domain objects are often quite rich, with many relations to other objects and helper methods for contexts other than search.

We tried Article = SearchArticle.extend(...), on the assumption that search-specific models were always a subset of the full versions, but were never really happy with it.


How are you using then the SearchUser? I would like to link then to the profile of the User, but I would need to load the full user, because the SearchUser is not sufficient. And with {{link-to ‘profile’ searchUser}} my model hook is not callend and therefore does not load the whole result.

PS: I am currently trying to implement typeahead.js with elasticsearch, but it is not as easy as I thought.


You can get around that by doing {{link-to searchUser.id 'profile'}}. Since the context of the profile route is not passed, the model hook will be called with the passed id as parameter.


Maybe this link helps:

Elasticsearch Ember Tutorial


We are using a custom data layer instead of ember-data and it works great. We decided to do this because we found that ember-data does not play nice with CQRS


We have implemented our own standard API which is then forwarding requests to the REST API of Elastic Search. This allows us also to do mapping between fields.


Hi, do you have some tips how to start write own API for Elastic search? I never did this before and I’m not sure where start. I’m looking for some examples, architecture pictures or anything else :slight_smile: I want do this with python (Flask), but examples can be in any language. Thanks


Looking for some tutorials/guides on getting EmberJS app to work with elastic search