docs: private static Map<String, QueryBuilder> buildFilters(RuleQuery query) {
      Map<String, QueryBuilder> filters = new HashMap<>();
  
      /* Add enforced filter on main type Rule */
      filters.put(
        FIELD_INDEX_TYPE,
        boolQuery().must(QueryBuilders.termsQuery(FIELD_INDEX_TYPE, TYPE_RULE.getType())));
  
      /* Add enforced filter on rules that are REMOVED */
      filters.put(FIELD_RULE_STATUS,
        boolQuery().mustNot(
          QueryBuilders.termQuery(FIELD_RULE_STATUS,
            RuleStatus.REMOVED.toString())));
  
      if (StringUtils.isNotEmpty(query.getInternalKey())) {
        filters.put(FIELD_RULE_INTERNAL_KEY,
          QueryBuilders.termQuery(FIELD_RULE_INTERNAL_KEY, query.getInternalKey()));
      }
  
      if (StringUtils.isNotEmpty(query.getRuleKey())) {
        filters.put(FIELD_RULE_RULE_KEY,
          QueryBuilders.termQuery(FIELD_RULE_RULE_KEY, query.getRuleKey()));
      }
  
      if (isNotEmpty(query.getLanguages())) {
        filters.put(FIELD_RULE_LANGUAGE,
          QueryBuilders.termsQuery(FIELD_RULE_LANGUAGE, query.getLanguages()));
      }
  
      if (isNotEmpty(query.getRepositories())) {
        filters.put(FIELD_RULE_REPOSITORY,
          QueryBuilders.termsQuery(FIELD_RULE_REPOSITORY, query.getRepositories()));
      }
  
      if (isNotEmpty(query.getSeverities())) {
        filters.put(FIELD_RULE_SEVERITY,
          QueryBuilders.termsQuery(FIELD_RULE_SEVERITY, query.getSeverities()));
      }
  
      if (StringUtils.isNotEmpty(query.getKey())) {
        filters.put(FIELD_RULE_KEY,
          QueryBuilders.termQuery(FIELD_RULE_KEY, query.getKey()));
      }
  
      if (isNotEmpty(query.getTags())) {
        filters.put(FIELD_RULE_EXTENSION_TAGS,
          buildTagsFilter(query.getTags(), query.getOrganization()));
      }
  
      Collection<RuleType> types = query.getTypes();
      if (isNotEmpty(types)) {
        List<String> typeNames = types.stream().map(RuleType::toString).collect(MoreCollectors.toList());
        filters.put(FIELD_RULE_TYPE,
          QueryBuilders.termsQuery(FIELD_RULE_TYPE, typeNames));
      }
  
      if (query.getAvailableSinceLong() != null) {
        filters.put("availableSince", QueryBuilders.rangeQuery(FIELD_RULE_CREATED_AT)
          .gte(query.getAvailableSinceLong()));
      }
  
      if (isNotEmpty(query.getStatuses())) {
        Collection<String> stringStatus = new ArrayList<>();
        for (RuleStatus status : query.getStatuses()) {
          stringStatus.add(status.name());
        }
        filters.put(FIELD_RULE_STATUS,
          QueryBuilders.termsQuery(FIELD_RULE_STATUS, stringStatus));
      }
  
      Boolean isTemplate = query.isTemplate();
      if (isTemplate != null) {
        filters.put(FIELD_RULE_IS_TEMPLATE,
          QueryBuilders.termQuery(FIELD_RULE_IS_TEMPLATE, Boolean.toString(isTemplate)));
      }
  
      boolean includeExternal = query.includeExternal();
      if (!includeExternal) {
        filters.put(FIELD_RULE_IS_EXTERNAL,
          QueryBuilders.termQuery(FIELD_RULE_IS_EXTERNAL, false));
      }
  
      String template = query.templateKey();
      if (template != null) {
        filters.put(FIELD_RULE_TEMPLATE_KEY,
          QueryBuilders.termQuery(FIELD_RULE_TEMPLATE_KEY, template));
      }
  
      /* Implementation of activation query */
      QProfileDto profile = query.getQProfile();
      if (query.getActivation() != null && profile != null) {
        QueryBuilder childQuery = buildActivationFilter(query, profile);
  
        if (TRUE.equals(query.getActivation())) {
          filters.put("activation",
            JoinQueryBuilders.hasChildQuery(TYPE_ACTIVE_RULE.getName(),
              childQuery, ScoreMode.None));
        } else if (FALSE.equals(query.getActivation())) {
          filters.put("activation",
            boolQuery().mustNot(
              JoinQueryBuilders.hasChildQuery(TYPE_ACTIVE_RULE.getName(),
                childQuery, ScoreMode.None)));
        }
        QProfileDto compareToQProfile = query.getCompareToQProfile();
        if (compareToQProfile != null) {
          filters.put("comparison",
            JoinQueryBuilders.hasChildQuery(
              TYPE_ACTIVE_RULE.getName(),
              boolQuery().must(QueryBuilders.termQuery(FIELD_ACTIVE_RULE_PROFILE_UUID, compareToQProfile.getRulesProfileUuid())),
              ScoreMode.None));
        }
      }
  
      return filters;
    }