Popular blog tags
What you're trying to do is form a compound query from two queries, where both queries must be satisfied by a document in order for it to be considered a match. A bool query is used to combine queries in this manner, using the must clause to specify both queries must be satisfied. Here's an example, with the object initializer syntax var client = new ElasticClient(); var indexName = "index-name"; var mustClauses = new List<QueryContainer>(); mustClauses.Add(new TermQuery { Field = new Field("description"), Value = "white" }); mustClauses.Add(new NumericRangeQuery { Field = new Field("price"), LessThanOrEqualTo = 3000, GreaterThanOrEqualTo = 2000 }); var searchRequest = new SearchRequest<Product>(indexName) { Size = 10, From = 0, Query = new BoolQuery { Must = mustClauses } }; var searchResponse = client.Search<Product>(searchRequest); With the range query, a document is either a match for the query clause or not, so we can forgo a score being calculated for the query by adding it as a bool query filter clause var indexName = "index-name"; var mustClauses = new List<QueryContainer>(); var filterClauses = new List<QueryContainer>(); mustClauses.Add(new TermQuery { Field = new Field("description"), Value = "white" }); filterClauses.Add(new NumericRangeQuery { Field = new Field("price"), LessThanOrEqualTo = 3000, GreaterThanOrEqualTo = 2000 }); var searchRequest = new SearchRequest<Product>(indexName) { Size = 10, From = 0, Query = new BoolQuery { Must = mustClauses, Filter = filterClauses } }; var searchResponse = client.Search<Product>(searchRequest);.