Giter Club home page Giter Club logo

Comments (8)

spalger avatar spalger commented on May 18, 2024

While allowing relative paths in the browser certainly makes sense, it would be broken by the cluster discovery functionality. Maybe you should try this approach instead:

angular.module('components.search')
  .service('es', function (esFactory) {
    return esFactory({
      host: window.location.protocol + '//' + window.location.host + '/services/elastic'
    });
  });

from elasticsearch-js.

DeanPoulin avatar DeanPoulin commented on May 18, 2024

Well, that doesn't allow us to use grunt-connect-proxy (https://github.com/drewzboto/grunt-connect-proxy). Grunt connect proxy is specifically looking for relative path requests made through $http which it then reroutes through grunt (node) server side to the actual web server configured in grunt.

Your suggestion is causing http requests to http://localhost/services/elastic instead of http://localhost:9000/services/elastic. I'll try a couple other things and report what's happening while I debug through the code.

from elasticsearch-js.

DeanPoulin avatar DeanPoulin commented on May 18, 2024

As far as I know we're using this library to just query elastic search (http://elasticsearch.github.io/elasticsearch-js/api.html#search). Perhaps we can just use raw $http requests with the elastic dsl in the http request body.

from elasticsearch-js.

spalger avatar spalger commented on May 18, 2024

That's a fair observation. If you are only doing search queries, and your entire cluster is behind a load balancer, then using elasticsearch.js in the browser is probably overkill.

from elasticsearch-js.

spalger avatar spalger commented on May 18, 2024

Not sure why I didn't think about this earlier, but you do something like this:

return esFactory({
  host: {
    host: '',
    port: '',
    path: '/services/elastic'
  }
});

right now this will cause the requests to go to http:///services/elastic but it should go to /services/elastic. I'll get that bug patched

from elasticsearch-js.

boneill42 avatar boneill42 commented on May 18, 2024

Nice, great thinking @spenceralger.

from elasticsearch-js.

spalger avatar spalger commented on May 18, 2024

@DeanPoulin Just updated the master build, if you want to give it a shot. Check out the unit tests for an example.

from elasticsearch-js.

DeanPoulin avatar DeanPoulin commented on May 18, 2024

@spenceralger thanks for your help, I'll give it a spin and let you know how it goes. Much appreciated.

from elasticsearch-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.