I am currently attempting to store a document in a database to be able to quickly pull up what words are in a certain location.
Example query: /doc1?start=2,end=5
This would retrieve the second to fifth word in that document. I am open to using any type of database. I would just like to not have to load and parse the whole document for these words every query.
Currently I am looking at loading words up into something like elasticsearch or redis with a format
{word:"Apple",index:1}
with a hierarchy to denote document. Is this a useful approach to my problem or should I be looking elsewhere?