private Set<String> getFieldsToGenerate(
     Map<String, String> perAnalyzerField, Fields fieldsObject) {
   Set<String> selectedFields = new HashSet<>();
   for (String fieldName : fieldsObject) {
     if (perAnalyzerField.containsKey(fieldName)) {
       selectedFields.add(fieldName);
     }
   }
   return selectedFields;
 }
 private Analyzer getAnalyzerAtField(
     String field, @Nullable Map<String, String> perFieldAnalyzer) {
   MapperService mapperService = indexShard.mapperService();
   Analyzer analyzer;
   if (perFieldAnalyzer != null && perFieldAnalyzer.containsKey(field)) {
     analyzer = mapperService.analysisService().analyzer(perFieldAnalyzer.get(field).toString());
   } else {
     analyzer = mapperService.smartNameFieldMapper(field).indexAnalyzer();
   }
   if (analyzer == null) {
     analyzer = mapperService.analysisService().defaultIndexAnalyzer();
   }
   return analyzer;
 }