code: public void createIndex(String collectionName, List<String> columnList, int order)
      {
          DBCollection coll = mongoDb.getCollection(collectionName);
  
          List<DBObject> indexes = coll.getIndexInfo(); // List of all current
          // indexes on collection
          Set<String> indexNames = new HashSet<String>(); // List of all current
          // index names
          for (DBObject index : indexes)
          {
              BasicDBObject obj = (BasicDBObject) index.get("key");
              Set<String> set = obj.keySet(); // Set containing index name which
              // is key
              indexNames.addAll(set);
          }
  
          // Create index if not already created
          for (String columnName : columnList)
          {
              if (!indexNames.contains(columnName))
              {
                  KunderaCoreUtils.printQuery("Create index on:" + columnName, showQuery);
                  coll.createIndex(new BasicDBObject(columnName, order));
              }
          }
      }
docs: Creates the index.
  
  @param collectionName
  the collection name
  @param columnList
  the column list
  @param order
  the order