Fully custom sparse search

I want to try to create an index, where for each document it will index directly the document's tokens and respective score. Then, at query time, I want to multiply each query token score with the correspond token in every document, followed by a sort.
So, in resume, I just want to write a custom inverted index like BM25, but where I will feed the tokens, the respective scores and the ranking function.
Is this doable with elasticsearch?