How to group by value in certain period?

Hello! Could anyone help me with a query?
I have such a gauge metrics:

# HELP searcher_document_search_words_total  
# TYPE searcher_document_search_words_total gauge
searcher_document_search_words_total{application="application",document="items",} 3.0

This metrics gauge value is always in range from 1 to 50. This value is some kind of unique group.

I want to build a query, that shows a graph or a table with the sum of each group quantity over certain period of time.

Could anyone be so kind to help me with the query?

I do have some similar query to be solved? my environment is Grafana with ElasticSearch database.

Want to group values as below as from the output.

// table header
| ServiceId | 0-1 | 1-5 | 5-10 |

|AYT11026 | Sum of all values under | Same as prev colum | Same as previous clmn|
this group/total value

|AYT11030 | Sum of all values under | Same as prev colum | Same as previous clmn|
this group/total value

Actually I am new to the grafana and trying to get this sorted out. Please help.

Cheers
Dilli