Is there a "standard" way to store result of query into index?

You would normally do that on the client side by a separate request.

I'm now exaxtly sure what is the ask here but maybe pipeline aggregations, more specifically the bucket selector aggregation can help here.