ElasticLite.Client 1.0.1

dotnet add package ElasticLite.Client --version 1.0.1
                    
NuGet\Install-Package ElasticLite.Client -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ElasticLite.Client" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ElasticLite.Client" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ElasticLite.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ElasticLite.Client --version 1.0.1
                    
#r "nuget: ElasticLite.Client, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ElasticLite.Client@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ElasticLite.Client&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ElasticLite.Client&version=1.0.1
                    
Install as a Cake Tool

轻量版操作ElasticSearch工具

Nuget 包搜索 ElasticLite.Client 并且安装

实例化

List<string> urls = new List<string>(){ "http://localhost:9200/"};

ElasticConnection elasticConnection = new ElasticConnection(urls);

  1. 判断 index 是否存在:

    bool exists = elasticConnection.Head(indexName);

  2. 创建 index, 并且设置mapping:

    var result = elasticConnection.Put(indexName, mapping);

    if (result.Contains("\"acknowledged\":true")) return true;

  3. 索引数据:

    var result = elasticConnection.Post("person/doc/1", json);

    if (result.Contains("\"successful\":1")) return true;

  4. 删除数据:

    var result = elasticConnection.Delete("person/doc/1");

    if (result.Contains("\"successful\":1")) return true;

  5. 搜索数据:

    var result = elasticConnection.Post(indexName, json);

    或者只取需要的数据

    var result = elasticConnection.Post(indexName+ "/_search?filter_path=hits.total,hits.hits._source,hits.hits._id,hits.hits.highlight", json);

  6. 更新数据最佳实践:

    确保id一致使用索引接口来修改

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 718 11/29/2019
1.0.0 631 11/29/2019

改变描述