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); }