Browser Buildsedit

We also provide builds of the elasticsearch.js client for use in the browser. These versions of the client are currently experimental. We test these builds using saucelabs in Chrome, Firefox, and Internet Explorer 10, and 11.

While there is a way to get it working in IE 9, the browser severely limits what you can do with cross-domain requests. Because of these limits, many of the API calls and other functionality do not work.

Boweredit

If you use bower to manage your dependencies, then just run:

bower install elasticsearch

NPMedit

If you use npm to manage your dependencies, then just run:

npm install elasticsearch-browser

Downloadedit

Angular Buildedit

  • Registers an esFactory factory in the "elasticsearch" module
  • Uses Angular’s $http service
  • Returns promises using Angular’s $q service to properly trigger digest cycles within Angular
Note

Checkout an example that integrates elasticsearch.js with angular on GitHub

Include the "elasticsearch" module in your app. 

var myApp = angular.module('myApp', ['elasticsearch']);

Create a client instance and register it as a service. 

module.service('client', function (esFactory) {
  return esFactory({
    host: 'localhost:9200',
    // ...
  });
});

jQuery Buildedit

  • Uses jQuery’s .ajax() functionality
  • Returns jQuery "promises"
  • Registers the module at jQuery.es

Create a client with the jQuery build. 

var client = new $.es.Client({
  hosts: 'localhost:9200'
});