This documentation contains work-in-progress information for future Elastic Stack and Cloud releases. Use the version selector to view supported release docs. It also contains some Elastic Cloud serverless information. Check out our serverless docs for more details.
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); }