using RestSharp; using RestSharp.Extensions; using RestSharp.Serializers; using RestSharp.Authenticators; using System.Security.Cryptography.X509Certificates; using System.Net; namespace ElasticSearchStudy.App { internal class Program { static void Main(string[] args) { Console.WriteLine("使用 ElistcSearch WebApi"); var option = new RestClientOptions() { BaseUrl = new Uri("https://localhost:9200"), Authenticator = new HttpBasicAuthenticator("elastic", "jLAglHZ1Wvt9ikOjb2TY") }; var restClient = new RestClient(option); var request = new RestRequest("/_cluster/health", Method.Get); var dd = restClient.Get(request); } } }