'Query users with 6 order days in the last 4 months from Elastic Search

I have an order index in our elastic search. The data is as follows { "id":"value", "user_id":"value", "created_at":"2021-06-07T07:36:02.000Z" ..... }

A user can order more than once in a day.

I want to fetch all the users who have greater than 6 order days in the last 4 months.

I need help with this query?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source