ElasticSearchLite.NetCore 1.3.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ElasticSearchLite.NetCore --version 1.3.0.2
NuGet\Install-Package ElasticSearchLite.NetCore -Version 1.3.0.2
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="ElasticSearchLite.NetCore" Version="1.3.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ElasticSearchLite.NetCore --version 1.3.0.2
#r "nuget: ElasticSearchLite.NetCore, 1.3.0.2"
#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.
// Install ElasticSearchLite.NetCore as a Cake Addin
#addin nuget:?package=ElasticSearchLite.NetCore&version=1.3.0.2

// Install ElasticSearchLite.NetCore as a Cake Tool
#tool nuget:?package=ElasticSearchLite.NetCore&version=1.3.0.2

Synopsis

A simple .NET Core wrapper for ElasticSearch.Net

Wiki Page

Wiki

Code Example

Connecting to a node(s)

var client = new ElasticLiteClient("http://myserver:9200", "http://myserver:9201");

Implement IElasticPoco interface for your pocos.

public class MyPoco : IElasticPoco
{
    public string Id { get; set; }
    public string Type { get; set; }
    public string Index { get; set; }
    public double? Score { get; set; }
    public Tag Tag { get; set; }
    public Position Position { get; set; }
    public string Name { get; set; }
    public DateTime LastModified { get; set; }
}
public class Tag
{
    public string Name { get; set; }
    public string Summary { get; set; }
}
public class Position
{
    public double X { get; set; }
    public double Y { get; set; }
}

Query Examples

Search Example

After creating a new ElasticLiteClient object, you can build up your Search object which requires an index to use the Search API from ElasticSearch. After this the search can be specified with different methods like: Term, Match, Range, Sort, Take, Skip.

var client = new ElasticLiteClient("http://myserver:9200");

// Term query example
var pocosFoundWithTerm = Search
    .In("mypocoindex")
    .Return<MyPoco>()
    .Term(p => p.Name, "ABCDEFG")
    .Sort(p => p.LastModified, ElasticSortOrders.Descending)
    .Take(20)
    .Skip(0)
    .ExecuteWith(client);
    
// Match query example
var pocosFoundWithMatch = Search
    .In("mypocoindex")
    .Return<MyPoco>()
    .Match(p => p.Name, "ABCD EFGH")
    	.Operator(ElasticOperators.Or)
    .Sort(p => p.LastModified)
    	.ThenBy(p => p.Score, ElasticSortOrders.Descending)
    .ExecuteWith(client);

Index Example

The add a document to ElasticSearch using a POCO object, the POCO will require the index and type name which will be used by the Index API from ElasticSearch. After the request is completed the poco's Id property will be updated if it hasn't been set in the before the request, in which case the given Id will be set in ElasticSearch.

var client = new ElasticLiteClient("http://myserver:9200");
var poco = new MyPoco 
{ 
    Index = "mypocoindex", 
    Type = "mypoco", 
    Name = "ElasticSearch is awesome!",
	LastModified = DateTime.Now()
};

Index.Document(poco)
    .ExecuteWith(client);

Update Example

Update can be used to persist POCO changes to ElasticSearch as in seen in this example below. The POCO does require a valid Id property. That also goes for Index and Type like previously.

var client = new ElasticLiteClient("http://myserver:9200");
poco.LastModified = DateTime.UtcNow;

Update
    .Document(poco)
    .ExecuteWith(client);

Delete POCO Example

Delete will remove one existing document from ElasticSearch when it's constructed from a POCO.

var client = new ElasticLiteClient("http://myserver:9200");

var deleteDocuments = Delete
    .Document(poco)
    .ExecuteWith(client);

Delete Query Example

Delete can also be used as a query to remove multiple documents from ElasticSearch if necessary.

var client = new ElasticLiteClient("http://myserver:9200");

var deleteDocuments = Delete
    .From("mypocoindex")
    .Documents<MyPoco>()
    .Term(p => p.Name, "ABCDEFG")
    .ExecuteWith(client);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.3.1 1,486 6/11/2018
1.3.0.2 921 5/15/2018
1.3.0.1 891 5/14/2018
1.3.0 1,006 5/13/2018
1.2.2 1,185 12/2/2017
1.2.1.2 1,417 12/1/2017
1.2.1.1 1,090 11/20/2017
1.2.1 1,074 11/9/2017
1.2.0 1,034 10/13/2017
1.1.2 1,466 9/15/2017
1.1.1 1,106 9/10/2017
1.1.0.2 1,182 8/31/2017
1.1.0.1 1,084 8/30/2017
1.1.0 1,092 8/28/2017
1.0.7.1 1,114 8/25/2017
1.0.7 1,151 8/25/2017
1.0.6 1,100 8/17/2017
1.0.5.1 1,111 8/1/2017
1.0.5 1,114 8/1/2017
1.0.4 1,179 7/31/2017
1.0.3 1,183 7/27/2017
1.0.2 1,193 7/21/2017
1.0.1 1,121 7/19/2017
1.0.0 1,139 7/19/2017
0.9.9 1,221 7/11/2017
0.9.8 1,141 7/7/2017
0.9.7 1,055 7/5/2017
0.9.6 1,089 7/4/2017
0.9.5 1,142 6/29/2017
0.9.4 1,114 6/28/2017
0.9.3 1,184 6/2/2017
0.9.2 1,158 5/29/2017
0.9.1 1,101 5/23/2017
0.9.0 1,309 5/22/2017

- Added the missing types to utilize the aggregation functions.