You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
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 简单测试项目");
|
|
|
|
var option = new RestClientOptions()
|
|
{
|
|
BaseUrl = new Uri("https://localhost:9201"),
|
|
Authenticator = new HttpBasicAuthenticator("elastic", "es-461400")
|
|
|
|
};
|
|
|
|
var restClient = new RestClient(option);
|
|
var request = new RestRequest("/_cat/health?v", Method.Get);
|
|
|
|
var healthResponse = restClient.Get(request);
|
|
|
|
var context = healthResponse.Content;
|
|
|
|
var ddd = context.Replace("\t", "");
|
|
|
|
var ccc = context.Split("\r\n");
|
|
var ccc2 = context.Split("\r");
|
|
var ccc3 = context.Split("\n");
|
|
|
|
|
|
Console.WriteLine(context);
|
|
}
|
|
}
|
|
} |