Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Latest commit

 

History

History
62 lines (49 loc) · 2.09 KB

browser_builds.asciidoc

File metadata and controls

62 lines (49 loc) · 2.09 KB

Browser Builds

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.

Bower

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

bower install elasticsearch

NPM

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

npm install elasticsearch-browser

Download

Angular Build

  • 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 Build

  • 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'
});