-
Notifications
You must be signed in to change notification settings - Fork 726
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
Allow the client to be initialized with a path prefix #76
Comments
I do understand that instead of trying something like:
I can use I am just curious if it can be done in a cleaner fashion like upstairs as well? |
Sure thing. Instead of using the |
thanks @spenceralger is there somethign for placing headers as well? where can the docs be updated to reflect path and header configurations? |
Yep, the host objects closely mimic the object that node's http.request accepts as it's argument. I'm surprised that I didn't write docs for those objects; it is on my TODO list now. In the mean time, here is a detailed list of all the keys you can use to describe a host and their defaults: var client = new elasticsearch.Client({
hosts: [
{
protocol: 'http',
host: 'localhost', // can also be hostname:
path: '/', // can also be pathname:
port: 9200,
auth: null, // Basic authentication i.e. 'user:password' to compute an Authorization header.
query: null, // query string, or an object which will be serialized to a query string
headers: null // object, this is only supported in node and es.jquery.js, expect full support soon
}
]
}); |
It helps to front-end elasticsearch with services like APIGEE that can act as a proxy.
Usually this means connecting to something like
my.apigee.com/v1/proxy/_search
instead ofmy.es.com/_search
... notice the difference being an additional prefix in the path/v1/proxy/
Can elasticsearch client initialization be tweaked to accomodate this by accepting a url prefix that it would add to all standard requests?
The text was updated successfully, but these errors were encountered: