From da2f449ff07a3eb088fd46e5521fe455b008e64e Mon Sep 17 00:00:00 2001
From: bicijinlian <bicijinlian@163.com>
Date: Wed, 12 Apr 2023 13:03:15 +0800
Subject: [PATCH] =?UTF-8?q?docs:=20=E6=95=B4=E7=90=86=E8=AF=A5=E5=BD=93=20?=
 =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=96=B0=E9=A1=B9=E7=9B=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Docs/RestClientDemo.http                      |  7 --
 Docs/使用Elastic.Client库管理ES.ipynb    | 37 ++++++++++
 ...��用Elastic.Client库管理ES集群.ipynb | 37 ++++++++++
 Docs/使用RestClient管理ES.http            | 12 +++
 Docs/使用RestClient管理ES集群.http      | 12 +++
 ...ES.ipynb => 使用RestSharp管理ES.ipynb} |  4 +-
 Docs/使用RestSharp管理ES集群.ipynb      | 37 ++++++++++
 Docs/启动ES.ipynb                           | 73 -------------------
 Docs/启动ES.ps1                             |  4 -
 ...��发部署.ipynb => 部署ES服务.ipynb} |  8 +-
 ElasticSearchStudy.App/Program.cs             | 21 ++++--
 ElasticSearchStudy.Core/Tweet.cs              |  3 +
 ElasticSearchStudy.UnitTest/说明.md         |  3 +
 ElasticSearchStudy.UseHttpAPI/UseHttp.http    |  4 -
 ElasticSearchStudy.UseHttpAPI/说明.md       |  3 +
 .../ClusterES.http                            |  5 ++
 ...asticSearchStudy.UseHttpRequestFile.csproj | 10 +++
 .../Program.cs                                | 10 +++
 .../SingleNodeES.http                         |  5 ++
 .../说明.md                                 |  3 +
 ElasticSearchStudy.sln                        | 19 ++++-
 21 files changed, 217 insertions(+), 100 deletions(-)
 delete mode 100644 Docs/RestClientDemo.http
 create mode 100644 Docs/使用Elastic.Client库管理ES.ipynb
 create mode 100644 Docs/使用Elastic.Client库管理ES集群.ipynb
 create mode 100644 Docs/使用RestClient管理ES.http
 create mode 100644 Docs/使用RestClient管理ES集群.http
 rename Docs/{HttpApi操作ES.ipynb => 使用RestSharp管理ES.ipynb} (83%)
 create mode 100644 Docs/使用RestSharp管理ES集群.ipynb
 delete mode 100644 Docs/启动ES.ipynb
 delete mode 100644 Docs/启动ES.ps1
 rename Docs/{ES本机开发部署.ipynb => 部署ES服务.ipynb} (97%)
 create mode 100644 ElasticSearchStudy.UnitTest/说明.md
 delete mode 100644 ElasticSearchStudy.UseHttpAPI/UseHttp.http
 create mode 100644 ElasticSearchStudy.UseHttpAPI/说明.md
 create mode 100644 ElasticSearchStudy.UseHttpRequestFile/ClusterES.http
 create mode 100644 ElasticSearchStudy.UseHttpRequestFile/ElasticSearchStudy.UseHttpRequestFile.csproj
 create mode 100644 ElasticSearchStudy.UseHttpRequestFile/Program.cs
 create mode 100644 ElasticSearchStudy.UseHttpRequestFile/SingleNodeES.http
 create mode 100644 ElasticSearchStudy.UseHttpRequestFile/说明.md

diff --git a/Docs/RestClientDemo.http b/Docs/RestClientDemo.http
deleted file mode 100644
index e3f6471..0000000
--- a/Docs/RestClientDemo.http
+++ /dev/null
@@ -1,7 +0,0 @@
-GET http://www.baidu.com
-
-###
-
-GET https://www.bing.com
-###
-curl --request GET --url http://www.baidu.com/ --header 'user-agent: vscode-restclient'
diff --git a/Docs/使用Elastic.Client库管理ES.ipynb b/Docs/使用Elastic.Client库管理ES.ipynb
new file mode 100644
index 0000000..37c8d5a
--- /dev/null
+++ b/Docs/使用Elastic.Client库管理ES.ipynb
@@ -0,0 +1,37 @@
+{
+ "cells": [
+  {
+   "attachments": {},
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "使用.NET专用客户端 Elastic.Client 库,管理单节点ES\n",
+    "==============================================="
+   ]
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": ".NET (C#)",
+   "language": "C#",
+   "name": ".net-csharp"
+  },
+  "language_info": {
+   "name": "polyglot-notebook"
+  },
+  "orig_nbformat": 4,
+  "polyglot_notebook": {
+   "kernelInfo": {
+    "defaultKernelName": "csharp",
+    "items": [
+     {
+      "aliases": [],
+      "name": "csharp"
+     }
+    ]
+   }
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/Docs/使用Elastic.Client库管理ES集群.ipynb b/Docs/使用Elastic.Client库管理ES集群.ipynb
new file mode 100644
index 0000000..74c9b4f
--- /dev/null
+++ b/Docs/使用Elastic.Client库管理ES集群.ipynb
@@ -0,0 +1,37 @@
+{
+ "cells": [
+  {
+   "attachments": {},
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "使用.NET专用客户端 Elastic.Client 库,管理集群\n",
+    "============================================"
+   ]
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": ".NET (C#)",
+   "language": "C#",
+   "name": ".net-csharp"
+  },
+  "language_info": {
+   "name": "polyglot-notebook"
+  },
+  "orig_nbformat": 4,
+  "polyglot_notebook": {
+   "kernelInfo": {
+    "defaultKernelName": "csharp",
+    "items": [
+     {
+      "aliases": [],
+      "name": "csharp"
+     }
+    ]
+   }
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/Docs/使用RestClient管理ES.http b/Docs/使用RestClient管理ES.http
new file mode 100644
index 0000000..0e5795d
--- /dev/null
+++ b/Docs/使用RestClient管理ES.http
@@ -0,0 +1,12 @@
+
+### 请求ES首页
+GET https://127.0.0.1:9201
+Content-Type: application/json
+Authorization: Basic elastic:es-461400
+
+### 请求ES节点信息
+GET https://127.0.0.1:9201/_cat/nodes
+Content-Type: application/json
+Authorization: Basic elastic:es-461400
+###
+curl --request GET --url http://www.baidu.com/ --header 'user-agent: vscode-restclient'
diff --git a/Docs/使用RestClient管理ES集群.http b/Docs/使用RestClient管理ES集群.http
new file mode 100644
index 0000000..0e5795d
--- /dev/null
+++ b/Docs/使用RestClient管理ES集群.http
@@ -0,0 +1,12 @@
+
+### 请求ES首页
+GET https://127.0.0.1:9201
+Content-Type: application/json
+Authorization: Basic elastic:es-461400
+
+### 请求ES节点信息
+GET https://127.0.0.1:9201/_cat/nodes
+Content-Type: application/json
+Authorization: Basic elastic:es-461400
+###
+curl --request GET --url http://www.baidu.com/ --header 'user-agent: vscode-restclient'
diff --git a/Docs/HttpApi操作ES.ipynb b/Docs/使用RestSharp管理ES.ipynb
similarity index 83%
rename from Docs/HttpApi操作ES.ipynb
rename to Docs/使用RestSharp管理ES.ipynb
index f8d9a90..2c68f75 100644
--- a/Docs/HttpApi操作ES.ipynb
+++ b/Docs/使用RestSharp管理ES.ipynb
@@ -5,8 +5,8 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "使用HTTP API 操作 ES\n",
-    "==================="
+    "使用 RestSharp 通过 ES WebApi 接口管理 ES\n",
+    "======================================="
    ]
   }
  ],
diff --git a/Docs/使用RestSharp管理ES集群.ipynb b/Docs/使用RestSharp管理ES集群.ipynb
new file mode 100644
index 0000000..2c68f75
--- /dev/null
+++ b/Docs/使用RestSharp管理ES集群.ipynb
@@ -0,0 +1,37 @@
+{
+ "cells": [
+  {
+   "attachments": {},
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "使用 RestSharp 通过 ES WebApi 接口管理 ES\n",
+    "======================================="
+   ]
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": ".NET (C#)",
+   "language": "C#",
+   "name": ".net-csharp"
+  },
+  "language_info": {
+   "name": "polyglot-notebook"
+  },
+  "orig_nbformat": 4,
+  "polyglot_notebook": {
+   "kernelInfo": {
+    "defaultKernelName": "csharp",
+    "items": [
+     {
+      "aliases": [],
+      "name": "csharp"
+     }
+    ]
+   }
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/Docs/启动ES.ipynb b/Docs/启动ES.ipynb
deleted file mode 100644
index 8b33a83..0000000
--- a/Docs/启动ES.ipynb
+++ /dev/null
@@ -1,73 +0,0 @@
-{
- "cells": [
-  {
-   "attachments": {},
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "启动ES相关服务\n",
-    "============="
-   ]
-  },
-  {
-   "attachments": {},
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## 启动本机单节点 ES 及 kibana"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {
-    "dotnet_interactive": {
-     "language": "pwsh"
-    },
-    "polyglot_notebook": {
-     "kernelName": "pwsh"
-    }
-   },
-   "outputs": [],
-   "source": [
-    "#!powershell\n",
-    "# 判断ES服务是否启动\n",
-    "\n",
-    "cd \"D:\\ELK\\8.7.0\\SingleNode\\\"\n",
-    ".\\启动脚本.bat"
-   ]
-  },
-  {
-   "attachments": {},
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## 启动Kibana"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": ".NET (C#)",
-   "language": "C#",
-   "name": ".net-csharp"
-  },
-  "language_info": {
-   "name": "polyglot-notebook"
-  },
-  "orig_nbformat": 4,
-  "polyglot_notebook": {
-   "kernelInfo": {
-    "defaultKernelName": "csharp",
-    "items": [
-     {
-      "aliases": [],
-      "name": "csharp"
-     }
-    ]
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
diff --git a/Docs/启动ES.ps1 b/Docs/启动ES.ps1
deleted file mode 100644
index 1f5560b..0000000
--- a/Docs/启动ES.ps1
+++ /dev/null
@@ -1,4 +0,0 @@
-# 启动ES及Kibana
-Set-Location "D:\ELK\8.7.0\SingleNode\"
-
-.\启动脚本.bat
\ No newline at end of file
diff --git a/Docs/ES本机开发部署.ipynb b/Docs/部署ES服务.ipynb
similarity index 97%
rename from Docs/ES本机开发部署.ipynb
rename to Docs/部署ES服务.ipynb
index 22ec872..72444de 100644
--- a/Docs/ES本机开发部署.ipynb
+++ b/Docs/部署ES服务.ipynb
@@ -5,8 +5,8 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "ES本机开发环境部署\n",
-    "================"
+    "部署本机ES服务\n",
+    "============="
    ]
   },
   {
@@ -22,7 +22,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "## 本机单机部署(启动默认安全设置)"
+    "## 本机单机部署(启动默认安全设)"
    ]
   },
   {
@@ -114,7 +114,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "## 本机三节点集群(启用安全)\n"
+    "## 本机三节点集群(启用默认安全)\n"
    ]
   },
   {
diff --git a/ElasticSearchStudy.App/Program.cs b/ElasticSearchStudy.App/Program.cs
index 5d9fd48..dd686f1 100644
--- a/ElasticSearchStudy.App/Program.cs
+++ b/ElasticSearchStudy.App/Program.cs
@@ -12,19 +12,30 @@ namespace ElasticSearchStudy.App
     {
         static void Main(string[] args)
         {
-            Console.WriteLine("使用 ElistcSearch WebApi");
+            Console.WriteLine("使用 ElistcSearch 简单测试项目");
 
             var option = new RestClientOptions()
             {
-                BaseUrl = new Uri("https://localhost:9200"),
-                Authenticator = new HttpBasicAuthenticator("elastic", "jLAglHZ1Wvt9ikOjb2TY")
+                BaseUrl = new Uri("https://localhost:9201"),
+                Authenticator = new HttpBasicAuthenticator("elastic", "es-461400")
 
             };
 
             var restClient = new RestClient(option);
-            var request = new RestRequest("/_cluster/health", Method.Get);
+            var request = new RestRequest("/_cat/health?v", Method.Get);
 
-            var dd = restClient.Get(request);
+            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);
         }
     }
 }
\ No newline at end of file
diff --git a/ElasticSearchStudy.Core/Tweet.cs b/ElasticSearchStudy.Core/Tweet.cs
index b99ec5a..e5ad868 100644
--- a/ElasticSearchStudy.Core/Tweet.cs
+++ b/ElasticSearchStudy.Core/Tweet.cs
@@ -2,6 +2,9 @@
 
 namespace ElasticSearchStudy.Core
 {
+    /// <summary>
+    /// 索引文档定义
+    /// </summary>
     public class Tweet
     {
         public int Id { get; set; }
diff --git a/ElasticSearchStudy.UnitTest/说明.md b/ElasticSearchStudy.UnitTest/说明.md
new file mode 100644
index 0000000..b09799d
--- /dev/null
+++ b/ElasticSearchStudy.UnitTest/说明.md
@@ -0,0 +1,3 @@
+项目说明
+========
+使用 `Elasticsearch` 专用.NET 客户端 `Elastic.Clients` 类库,管理 `Elasticserach`
\ No newline at end of file
diff --git a/ElasticSearchStudy.UseHttpAPI/UseHttp.http b/ElasticSearchStudy.UseHttpAPI/UseHttp.http
deleted file mode 100644
index b469579..0000000
--- a/ElasticSearchStudy.UseHttpAPI/UseHttp.http
+++ /dev/null
@@ -1,4 +0,0 @@
-
-GET http://www.baidu.com
-### dfsdf 
-GET http://www.bing.com
\ No newline at end of file
diff --git a/ElasticSearchStudy.UseHttpAPI/说明.md b/ElasticSearchStudy.UseHttpAPI/说明.md
new file mode 100644
index 0000000..fcf9c01
--- /dev/null
+++ b/ElasticSearchStudy.UseHttpAPI/说明.md
@@ -0,0 +1,3 @@
+项目说明
+========
+使用 `RestSharp` Http库,通过 `Elasticsearch WebApi` 管理 ES
\ No newline at end of file
diff --git a/ElasticSearchStudy.UseHttpRequestFile/ClusterES.http b/ElasticSearchStudy.UseHttpRequestFile/ClusterES.http
new file mode 100644
index 0000000..c97cbdd
--- /dev/null
+++ b/ElasticSearchStudy.UseHttpRequestFile/ClusterES.http
@@ -0,0 +1,5 @@
+### 请求ES集群服务 WebApi
+### 首页
+GET https://127.0.0.1:9201/
+
+###
diff --git a/ElasticSearchStudy.UseHttpRequestFile/ElasticSearchStudy.UseHttpRequestFile.csproj b/ElasticSearchStudy.UseHttpRequestFile/ElasticSearchStudy.UseHttpRequestFile.csproj
new file mode 100644
index 0000000..74abf5c
--- /dev/null
+++ b/ElasticSearchStudy.UseHttpRequestFile/ElasticSearchStudy.UseHttpRequestFile.csproj
@@ -0,0 +1,10 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>
diff --git a/ElasticSearchStudy.UseHttpRequestFile/Program.cs b/ElasticSearchStudy.UseHttpRequestFile/Program.cs
new file mode 100644
index 0000000..3eb5b00
--- /dev/null
+++ b/ElasticSearchStudy.UseHttpRequestFile/Program.cs
@@ -0,0 +1,10 @@
+namespace ElasticSearchStudy.UseHttpRequestFile
+{
+    internal class Program
+    {
+        static void Main(string[] args)
+        {
+            Console.WriteLine("请直接使用项目内具有http后辍的文件,直接编写及发送httt请求");
+        }
+    }
+}
\ No newline at end of file
diff --git a/ElasticSearchStudy.UseHttpRequestFile/SingleNodeES.http b/ElasticSearchStudy.UseHttpRequestFile/SingleNodeES.http
new file mode 100644
index 0000000..7f6ce8c
--- /dev/null
+++ b/ElasticSearchStudy.UseHttpRequestFile/SingleNodeES.http
@@ -0,0 +1,5 @@
+### 请求单节点ES服务 WebApi
+### 首页
+GET https://127.0.0.1:9200/
+
+###
diff --git a/ElasticSearchStudy.UseHttpRequestFile/说明.md b/ElasticSearchStudy.UseHttpRequestFile/说明.md
new file mode 100644
index 0000000..322b7a1
--- /dev/null
+++ b/ElasticSearchStudy.UseHttpRequestFile/说明.md
@@ -0,0 +1,3 @@
+项目说明
+========
+`Visual Studio 2022` 内置支持:在http扩展名的文件里,直接编写与发送HTTP请求。类似于RestClient
\ No newline at end of file
diff --git a/ElasticSearchStudy.sln b/ElasticSearchStudy.sln
index eb984a5..31e79fb 100644
--- a/ElasticSearchStudy.sln
+++ b/ElasticSearchStudy.sln
@@ -9,7 +9,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElasticSearchStudy.Core", "
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElasticSearchStudy.UnitTest", "ElasticSearchStudy.UnitTest\ElasticSearchStudy.UnitTest.csproj", "{3008F5A9-43DA-48AF-883E-514FD71B65A2}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticSearchStudy.UseHttpAPI", "ElasticSearchStudy.UseHttpAPI\ElasticSearchStudy.UseHttpAPI.csproj", "{9218B8D7-B382-4C16-B060-B1CE2E2F9B47}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElasticSearchStudy.UseHttpAPI", "ElasticSearchStudy.UseHttpAPI\ElasticSearchStudy.UseHttpAPI.csproj", "{9218B8D7-B382-4C16-B060-B1CE2E2F9B47}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticSearchStudy.UseHttpRequestFile", "ElasticSearchStudy.UseHttpRequestFile\ElasticSearchStudy.UseHttpRequestFile.csproj", "{7B0E1527-66DB-45EC-BEFE-83D00723E45E}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{002B733F-1D54-4975-9AFF-ADE901B7E415}"
+	ProjectSection(SolutionItems) = preProject
+		Docs\使用Elastic.Client库管理ES.ipynb = Docs\使用Elastic.Client库管理ES.ipynb
+		Docs\使用Elastic.Client库管理ES集群.ipynb = Docs\使用Elastic.Client库管理ES集群.ipynb
+		Docs\使用RestClient管理ES.http = Docs\使用RestClient管理ES.http
+		Docs\使用RestClient管理ES集群.http = Docs\使用RestClient管理ES集群.http
+		Docs\使用RestSharp管理ES.ipynb = Docs\使用RestSharp管理ES.ipynb
+		Docs\使用RestSharp管理ES集群.ipynb = Docs\使用RestSharp管理ES集群.ipynb
+		Docs\部署ES服务.ipynb = Docs\部署ES服务.ipynb
+	EndProjectSection
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -33,6 +46,10 @@ Global
 		{9218B8D7-B382-4C16-B060-B1CE2E2F9B47}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{9218B8D7-B382-4C16-B060-B1CE2E2F9B47}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{9218B8D7-B382-4C16-B060-B1CE2E2F9B47}.Release|Any CPU.Build.0 = Release|Any CPU
+		{7B0E1527-66DB-45EC-BEFE-83D00723E45E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7B0E1527-66DB-45EC-BEFE-83D00723E45E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7B0E1527-66DB-45EC-BEFE-83D00723E45E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7B0E1527-66DB-45EC-BEFE-83D00723E45E}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE