Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added promise support to node client #49

Closed
wants to merge 2 commits into from

Conversation

surjikal
Copy link

Added promise support to the node client, without sacrificing backwards compatibility.

ejs.Request()
  .indices("tweets")
  .types("tweet")
  .query(ejs.TermQuery("user", "kimchi"))
  .doSearch()
  .then (results) ->
      console.log(results)

Note that you cannot use both callbacks and deferreds; If a callback is passed in, it will be used instead of the deferred's callback.

@mattweber
Copy link
Member

Thanks for the PR! With the release of the official javascript client, we have decided to remove all core low-level/transport support from elastic.js and focus on supporting the complete elasticsearch DSL on top of the official client. The official client supports promises and with the next version of elastic.js code should look like:

client.search({
  index: 'tweets',
  type: 'tweet',
  body: ejs.Request().query(ejs.TermQuery('user', 'kimchy'))
}).then(function (response) {
  console.log(response.body);
});

@mattweber mattweber closed this Dec 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants