public Index createIndex(
      String indexName,
      IndexType indexType,
      String indexedExpression,
      String fromClause,
      String imports,
      boolean loadEntries,
      Region region)
      throws IndexNameConflictException, IndexExistsException, RegionNotFoundException {

    if (pool != null) {
      throw new UnsupportedOperationException(
          "Index creation on the server is not supported from the client.");
    }
    PartitionedIndex parIndex = null;
    if (region == null) {
      region = getRegionFromPath(imports, fromClause);
    }
    RegionAttributes ra = region.getAttributes();

    // Asif: If the evistion action is Overflow to disk then do not allow index creation
    // It is Ok to have index creation if it is persist only mode as data will always
    // exist in memory
    // if(ra.getEvictionAttributes().getAction().isOverflowToDisk() ) {
    //  throw new
    // UnsupportedOperationException(LocalizedStrings.DefaultQueryService_INDEX_CREATION_IS_NOT_SUPPORTED_FOR_REGIONS_WHICH_OVERFLOW_TO_DISK_THE_REGION_INVOLVED_IS_0.toLocalizedString(regionPath));
    // }
    // if its a pr the create index on all of the local buckets.
    if (((LocalRegion) region).heapThresholdReached.get()
        && !InternalResourceManager.isLowMemoryExceptionDisabled()) {
      LocalRegion lr = (LocalRegion) region;
      throw new LowMemoryException(
          LocalizedStrings.ResourceManager_LOW_MEMORY_FOR_INDEX.toLocalizedString(region.getName()),
          lr.getHeapThresholdReachedMembers());
    }
    if (region instanceof PartitionedRegion) {
      try {
        parIndex =
            (PartitionedIndex)
                ((PartitionedRegion) region)
                    .createIndex(
                        false,
                        indexType,
                        indexName,
                        indexedExpression,
                        fromClause,
                        imports,
                        loadEntries);
      } catch (ForceReattemptException ex) {
        region
            .getCache()
            .getLoggerI18n()
            .info(
                LocalizedStrings
                    .DefaultQueryService_EXCEPTION_WHILE_CREATING_INDEX_ON_PR_DEFAULT_QUERY_PROCESSOR,
                ex);
      } catch (IndexCreationException exx) {
        region
            .getCache()
            .getLoggerI18n()
            .info(
                LocalizedStrings
                    .DefaultQueryService_EXCEPTION_WHILE_CREATING_INDEX_ON_PR_DEFAULT_QUERY_PROCESSOR,
                exx);
      }
      return parIndex;

    } else {

      IndexManager indexManager = IndexUtils.getIndexManager(region, true);
      Index index =
          indexManager.createIndex(
              indexName,
              indexType,
              indexedExpression,
              fromClause,
              imports,
              null,
              null,
              loadEntries);

      return index;
    }
  }