- .NET Clients: other versions:
- Introduction
- Getting started
- Installation
- Connecting
- Configuration
- Client concepts
- Using the .NET Client
- Troubleshooting
- Release notes
- Breaking changes policy
- Release notes v8.11.0
- Release notes v8.10.0
- Release notes v8.9.3
- Release notes v8.9.2
- Release notes v8.9.1
- Release notes v8.9.0
- Release notes v8.1.3
- Release notes v8.1.2
- Release notes v8.1.1
- Release notes v8.1.0
- Release notes v8.0.10
- Release notes v8.0.9
- Release notes v8.0.8
- Release notes v8.0.7
- Release notes v8.0.6
- Release notes v8.0.5
- Release notes v8.0.4
- Release notes v8.0.3
- Release notes v8.0.2
- Release notes v8.0.1
- Release notes v8.0.0
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); }
ElasticON events are back!
Learn about the Elastic Search AI Platform from the experts at our live events.
Register nowWas this helpful?
Thank you for your feedback.