sargeMonkey
sargeMonkey

Reputation: 696

using NEST (or another client) to run query on authenticated ES server

I searched the net for libraries which allow me to do queries against an authenticated (simple auth) and secure (https) endpoint, but the only solution I found was to implement the IConnection interface in NEST lib. Is there any other way to do it (out of the box)?

Upvotes: 0

Views: 1488

Answers (1)

Mattias Nordberg
Mattias Nordberg

Reputation: 1778

If you add the username and password to the URL, NEST will automatically add HTTP Basic auth headers to all requests.

For example:

var settings = new ConnectionSettings(new Uri("https://user:[email protected]"));

Shameless plug: I've also written a NEST guide that covers authentication as part of my company's hosted elasticsearch offering: http://support.facetflow.com/kb/getting-started/net-tutorial

Upvotes: 4

Related Questions