Comments (8)
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.
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.
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.
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.
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.
Nice, great thinking @spenceralger.
from elasticsearch-js.
@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.
@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)
- Support Cloudflare Workers / Vercel Edge Functions HOT 3
- The query attribute on the `EnrichPolicy` should be `QueryDslQueryContainer | QueryDslQueryContainer[]` not `string` HOT 3
- Bulk helper not giving indications on failure when using stream as datasource HOT 1
- Number of open connections spikes when retryable errors occur HOT 4
- Deno: Module '"npm:@elastic/elasticsearch"' has no exported member 'CatIndicesIndicesRecord'. HOT 1
- Internal module error HOT 1
- bulk helper add onSuccess callback HOT 3
- Content-Type header being changed to "text/plain" from "application/json" somewhere in the process of publishing a document to self-hosted Elasticsearch HOT 5
- Global client context not passed to Transport in 7.13.0 HOT 1
- Support for ES|QL HOT 2
- enum and/or type guard for QueryDslTextQueryType HOT 1
- search_after with sort on nested fields HOT 1
- Redaction mechanism transform arrays properties into objects HOT 1
- Nuxt 3 compatibility HOT 1
- Using the `[]` chars for an enrich policy name isn't wrapped correctly on `deletePolicy` method HOT 1
- ProductNotSupportedError: The client noticed that the server is not a supported distribution of Elasticsearch HOT 1
- Add types for plugins HOT 2
- Error parsing undici module in Next.js 14 project HOT 3
- MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 product-check listeners added HOT 2
- test issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elasticsearch-js.