Aggregate TopHit based on filter

I am working on a index that stores statistics about issue tracking. Each document is a snapshot of the state of a given project (number of open issues, etc). Each document is categorized by an organization, a project name, and tags.

I am using the "Last Value" in Lens "Top Hit" (in ES) to build graphs and it's working pretty well as long as I have a filter for one particular project. If I don't have an active filter to identify a project, Kibana uses one document, usually the last project that was indexed for the period. I'd like rather it to aggregate all projects.

So I'd like to understand how I can build the same graphs when I aggregate those "Last Value" documents (basically, one per projects). Is there a way to use a filter to let it sum the top hit per project? We're starting so an alternative would be a completely different structure for our document.

Hey - this should be doable. We'll want to run a terms aggregation on the project first, and then run a top hits aggregation on the resulting buckets.

Does dragging the project name to the x-axis (below timestamp) get you closer?

Does dragging the project name to the x-axis (below timestamp) get you closer?

Thanks for the suggestion.

This result in a "Break down by" configuration being added, which creates one line per project rather than aggregating them. I've looked in the option and didn't find something that would aggregate them.