diff --git a/Docs/HttpApi操作ES.ipynb b/Docs/HttpApi操作ES.ipynb new file mode 100644 index 0000000..f8d9a90 --- /dev/null +++ b/Docs/HttpApi操作ES.ipynb @@ -0,0 +1,37 @@ +{ + "cells": [ + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "使用HTTP API 操作 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/RestClientDemo.http b/Docs/RestClientDemo.http new file mode 100644 index 0000000..e3f6471 --- /dev/null +++ b/Docs/RestClientDemo.http @@ -0,0 +1,7 @@ +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/ElasticSearchStudy.Core/ElasticSearchStudy.Core.csproj b/ElasticSearchStudy.Core/ElasticSearchStudy.Core.csproj index ac1680c..2551831 100644 --- a/ElasticSearchStudy.Core/ElasticSearchStudy.Core.csproj +++ b/ElasticSearchStudy.Core/ElasticSearchStudy.Core.csproj @@ -6,7 +6,8 @@ - + + diff --git a/ElasticSearchStudy.UseHttpAPI/ElasticSearchStudy.UseHttpAPI.csproj b/ElasticSearchStudy.UseHttpAPI/ElasticSearchStudy.UseHttpAPI.csproj new file mode 100644 index 0000000..85d796c --- /dev/null +++ b/ElasticSearchStudy.UseHttpAPI/ElasticSearchStudy.UseHttpAPI.csproj @@ -0,0 +1,27 @@ + + + + net7.0 + enable + enable + + false + true + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/ElasticSearchStudy.UseHttpAPI/UseHttp.http b/ElasticSearchStudy.UseHttpAPI/UseHttp.http new file mode 100644 index 0000000..b469579 --- /dev/null +++ b/ElasticSearchStudy.UseHttpAPI/UseHttp.http @@ -0,0 +1,4 @@ + +GET http://www.baidu.com +### dfsdf +GET http://www.bing.com \ No newline at end of file diff --git a/ElasticSearchStudy.UseHttpAPI/UseXUnitTest.cs b/ElasticSearchStudy.UseHttpAPI/UseXUnitTest.cs new file mode 100644 index 0000000..ff17862 --- /dev/null +++ b/ElasticSearchStudy.UseHttpAPI/UseXUnitTest.cs @@ -0,0 +1,28 @@ +namespace ElasticSearchStudy.UseHttpAPI +{ + public class UseXUnitTest + { + [Fact] + public void Test1() + { + + } + + [Fact] + public void Test2() + { + RestClientOptions clientOptions = new RestClientOptions() + { + BaseUrl=new Uri("http://www.baidu.com"), + }; + RestClient client = new RestClient(clientOptions); + + RestRequest request = new RestRequest("", Method.Get); + + + var response = client.Get(request); + + Assert.True(response.IsSuccessStatusCode); + } + } +} \ No newline at end of file diff --git a/ElasticSearchStudy.UseHttpAPI/Usings.cs b/ElasticSearchStudy.UseHttpAPI/Usings.cs new file mode 100644 index 0000000..1546913 --- /dev/null +++ b/ElasticSearchStudy.UseHttpAPI/Usings.cs @@ -0,0 +1,6 @@ +global using Xunit; + +global using RestSharp; +global using RestSharp.Extensions; +global using RestSharp.Serializers; +global using RestSharp.Authenticators; \ No newline at end of file diff --git a/ElasticSearchStudy.sln b/ElasticSearchStudy.sln index 7d04d24..eb984a5 100644 --- a/ElasticSearchStudy.sln +++ b/ElasticSearchStudy.sln @@ -3,11 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.5.33516.290 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticSearchStudy.App", "ElasticSearchStudy.App\ElasticSearchStudy.App.csproj", "{215D6950-7B9F-4743-BD81-ACE3D7F1CAED}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElasticSearchStudy.App", "ElasticSearchStudy.App\ElasticSearchStudy.App.csproj", "{215D6950-7B9F-4743-BD81-ACE3D7F1CAED}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticSearchStudy.Core", "ElasticSearchStudy.Core\ElasticSearchStudy.Core.csproj", "{86F7481E-5EBB-45A9-8621-F2CAA486D73A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElasticSearchStudy.Core", "ElasticSearchStudy.Core\ElasticSearchStudy.Core.csproj", "{86F7481E-5EBB-45A9-8621-F2CAA486D73A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticSearchStudy.UnitTest", "ElasticSearchStudy.UnitTest\ElasticSearchStudy.UnitTest.csproj", "{3008F5A9-43DA-48AF-883E-514FD71B65A2}" +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}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,6 +29,10 @@ Global {3008F5A9-43DA-48AF-883E-514FD71B65A2}.Debug|Any CPU.Build.0 = Debug|Any CPU {3008F5A9-43DA-48AF-883E-514FD71B65A2}.Release|Any CPU.ActiveCfg = Release|Any CPU {3008F5A9-43DA-48AF-883E-514FD71B65A2}.Release|Any CPU.Build.0 = Release|Any CPU + {9218B8D7-B382-4C16-B060-B1CE2E2F9B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE