public void defineIndex(String indexName, IndexType indexType, String indexedExpression,
      String fromClause, String imports) throws RegionNotFoundException {
    IndexCreationData indexData = new IndexCreationData(indexName);
    indexData.setIndexData(indexType, fromClause, indexedExpression, imports);
    Region r = getRegionFromPath(imports, fromClause);
    synchronized (indexDefinitions) {
      HashSet<IndexCreationData> s = indexDefinitions.get(r);
      if (s == null) {
        s = new HashSet<>();
      }
      s.add(indexData);
      indexDefinitions.put(r, s);
    }
  }
Close the CQ Service after clean up if any.
geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQueryService.java