Refactoring IndicesAnalysisService

Using enums where possible in order to clean up the code in IndicesAnalysisService, also preparing those to support versioning, if wanted.

Also introduced a simpler more generic caching mechanism, and tests.