IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Query examples
editQuery examples
editThis page demonstrates how to perform a search request.
Fluent API
editvar response = await client .SearchAsync<Person>(search => search .Index("persons") .Query(query => query .Term(term => term .Field(x => x.FirstName) .Value("Florian") ) ) .Size(10) );
Object initializer API
editvar response = await client .SearchAsync<Person>(new SearchRequest<Person>("persons") { Query = Query.Term(new TermQuery(Infer.Field<Person>(x => x.FirstName)) { Value = "Florian" }), Size = 10 });
Consume the response
editforeach (var person in response.Documents) { Console.WriteLine(person.FirstName); }