Skip to content

cicorias/NEST

 
 

Repository files navigation

NEST Build Status

Strongly typed Elasticsearch client

NEST aims to be a .net client with a very concise API. Its main goal is to provide a solid strongly typed Elasticsearch client.

Indexing is as simple as:

var post = new Post() { Id = 12, ... }
var result = client.Index(post);

All the calls have async variants:

//t is a Task<ConnectionStatus>
var t = client.IndexAsync(post);

The typed client exposes a fluent interface and a powerful query dsl

var results = client.Search<ElasticSearchProject>(s => s
	.From(0)
	.Size(10)
	.Fields(f => f.Id, f => f.Name)
	.SortAscending(f => f.LOC)
	.SortDescending(f => f.Name)
	.Query(q=>
		q.Term(f=>f.Name, "NEST", Boost: 2.0) 
		|| q.Match(mq=>mq.OnField(f=>f.Name).Query(userInput))
	)
);

NEST also comes with a low level client that you can fall back to incase anything is missing:

//.Raw is of type IRawElasticClient
var results = this._client.Raw.SearchPost("myindex","elasticsearchprojects", new
{
	from = 0,
	size = 10,
	fields = new [] {"id", "name"},
	query = new {
		term = new {
			name = new {
				value= "NEST",
				boost = 2.0
			}
		}
	}
});

#Read the documentation here

additionally @joelabrahamsson wrote a great intro into elasticsearch on .NET using NEST.

Also checkout the searchbox.io guys rocking NEST on AppHarbor with their demo project

Installing

Nest can be installed through NuGet:

PM> Install-Package NEST

Or searching for "elasticsearch" will get you to nest as well.

#Who's using NEST?

Always keen to hear and list more uses ! hit me on @Mpdreamz

Questions, bugs, comments, requests

All of these are more then welcome on the github issues pages! I try to to at least reply within the same day.

Copyright

Copyright (c) 2010 Martijn Laarman and everyone wonderful enough to contribute to NEST

Many thanks to:

  • my ex-employer Q42 for supporting the development of NEST by donating 20% of my contract hours for NEST's development.
  • redgate for supplying me with an ANTS Memory Profiler 8 & ANTS Performance Profiler 8 licenses
  • jetBrains for supplying me with a dotTrace profiler license and a Resharper license
  • CodeBetter for hosting the continuous integration for NEST
  • Everyone who's been awesome enough to contribute back to NEST (You're listed automatically on the documentation page)

License

NEST is licensed under MIT. Refer to license.txt for more information.