ElasticSearch count nested fields

Viewed 7088

How do you count objects of a nested field (which is a nested objects list) which meet a certain condition in ElasticSearch?

EXAMPLE

Having Customer index, with type Customer which has a Services nested field with following structure:

public class Customer
{
    public int Id;
    public List<Service> Services;
}

public class Service
{
    public int Id;
    public DateTime Date;
    public decimal Rating;
}

How do I count all services which happened in June 2017 and got a rating higher than 5?

1 Answers
Related