code: private Index ensureIndexed(List<FieldSort> fieldNames,
                                  String indexName,
                                  IndexType indexType,
                                  Tokenizer tokenizer) throws QueryException {
          // synchronized to prevent race conditions in IndexCreator when looking for existing indexes
          // which have the same name or definition
          synchronized (this) {
              return IndexCreator.ensureIndexed(new Index(fieldNames,
                              indexName,
                              indexType,
                              tokenizer),
                      database,
                      dbQueue);
          }
      }
docs: Add a single, possibly compound, index for the given field names.
  
  This function generates a name for the new index.
  
  @param fieldNames List of field names in the sort format
  @param indexName Name of index to create or null to generate an index name.
  @param indexType The type of index (json or text currently supported)
  @param tokenizer
  Only text indexes support settings - Ex. { "tokenize" : "simple" }
  @return name of created index