How can you calculate something under aggregation conditions? How to count the number of events that meet given conditions? For example, how do I calculate purchases over the last 7 days? Or how do I calculate all purchases over 100 dollars in the last 7 days?
To achieve this, you can utilize elastic queries and generate reports in Tracardi. Firstly, it's important to learn how to craft Elasticsearch queries. For detailed guidance on Elasticsearch aggregations, please visit Elasticsearch Aggregations Documentation.
Here's how to create a report in Tracardi:
- Navigate to the 'Reporting' section.
- Complete the form and insert your Elasticsearch query.
- Test the query to see the results.
- Assign a name to your report and save it.
- Your report will now appear in the report listings.
- Open the report to find the endpoint (e.g.,
POST /report/f48d0c9f-8d5c-41e9-a04f-28c934189327/run
), which will fetch the query results. - These reports can also be integrated into workflows.
Alternatively, you can use metrics to execute an aggregation and store the results directly in the profile.