Override to provide code for creating the target index.

        By default it will be created without any special settings or mappings.
422009
def create_index(self):
        
        es = self._init_connection()
        if not es.indices.exists(index=self.index):
            es.indices.create(index=self.index, body=self.settings)
1282189
public void createMapping(String indexName, String mappingName, ArrayList<XContentBuilder> mappingSource) {
        IndicesExistsResponse existsResponse = this.client.admin().indices().prepareExists(indexName).execute()
                .actionGet();
        //If the index does not exists, it will be created without options
        if (!existsResponse.isExists()) {
            if (!createSingleIndex(indexName)) {
                throw new ElasticsearchException("Failed to create " + indexName
                        + " index.");
            }
        }
        BulkRequestBuilder bulkRequest = this.client.prepareBulk();
        for (int i = 0; i < mappingSource.size(); i++) {
            int aux = i + 1;

            IndexRequestBuilder res = this.client
                    .prepareIndex(indexName, mappingName, String.valueOf(aux)).setSource(mappingSource.get(i));
            bulkRequest.add(res);
        }
        bulkRequest.execute();
    }
272166
def create_indexes(clas,pool_or_cursor):
    ""
    for index in clas.INDEXES:
      # note: these are specified as either 'field,field,field' or a runnable query. you can put any query you want in there
      query = index if 'create index' in index.lower() else 'create index on %s (%s)'%(clas.TABLE,index)
      commit_or_execute(pool_or_cursor,query)
871507
private void createIndex() {
        try {
            client.createIndex(name(), workspace, columns.mappings(workspace));
            client.flush(name());
        } catch (IOException e) {
            throw new EsIndexException(e);
        }
    }
167756
def create(self, name, index=None):
        
        if index is None:
            index = len(self)
        self._create(name, index)
        return self[name]
1336756
public Index<SecondaryTable<T>> getOrCreateIndex()
   {
      List<Node> nodeList = childNode.get("index");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new IndexImpl<SecondaryTable<T>>(this, "index", childNode, nodeList.get(0));
      }
      return createIndex();
   }
1362533
def create_indexes(cls, target=None, recreate=False):
		
		
		# TODO: Nested indexes.
		
		results = []
		collection = cls.get_collection(target)
		
		if recreate:
			collection.drop_indexes()
		
		for index in cls.__indexes__.values():
			results.append(index.create(collection))
		
		return results
1164394
def __create_index(self, keys, index_options):
        
        index_doc = helpers._index_document(keys)
        index = {"key": index_doc}
        collation = validate_collation_or_none(
            index_options.pop('collation', None))
        index.update(index_options)

        with self._socket_for_writes() as sock_info:
            if collation is not None:
                if sock_info.max_wire_version < 5:
                    raise ConfigurationError(
                        'Must be connected to MongoDB 3.4+ to use collations.')
                else:
                    index['collation'] = collation
            cmd = SON([('createIndexes', self.name), ('indexes', [index])])
            try:
                self._command(
                    sock_info, cmd, read_preference=ReadPreference.PRIMARY,
                    codec_options=_UNICODE_REPLACE_CODEC_OPTIONS,
                    write_concern=self.write_concern,
                    parse_write_concern_error=True)
            except OperationFailure as exc:
                if exc.code in common.COMMAND_NOT_FOUND_CODES:
                    index["ns"] = self.__full_name
                    wcn = (self.write_concern if
                           self.write_concern.acknowledged else WriteConcern())
                    self.__database.system.indexes._insert(
                        sock_info, index, True, False, False, wcn)
                else:
                    raise
1087585
function _createIndex(indexName, indexData, value, ex, cb) {
    var callback = cb;
    var expiry = ex;
    if(!callback) {
      expiry = null;
      callback = ex;
    }

    // generate the index value
    var index = indexName + '-' +
      crypto.createHash('sha256').update(indexData).digest('hex');

    client.set(index, value, function(err, reply) {
      if(err) {
        return callback(err);
      }
      if(expiry) {
        return client.expire(index, expiry, function(err) {
          callback(err, reply);
        });
      }
      callback(err, reply);
    });
  }
988928
void initResultIndex() {

        int startIndex = 0;
        if ((m_pageIndex > 0) && (m_pageSize > 0)) {
            startIndex = (m_pageIndex - 1) * m_pageSize;
        }

        m_resultIndex = startIndex > m_resultSize ? m_resultSize : startIndex;
    }
208266
@Deprecated
	private static void createIndexWithSettingsInElasticsearch(Client client, String index, String settings) throws Exception {
		logger.trace("createIndex([{}])", index);

		assert client != null;
		assert index != null;

		CreateIndexRequestBuilder cirb = client.admin().indices().prepareCreate(index);

		// If there are settings for this index, we use it. If not, using Elasticsearch defaults.
		if (settings != null) {
			logger.trace("Found settings for index [{}]: [{}]", index, settings);
			cirb.setSource(settings, XContentType.JSON);
		}

		CreateIndexResponse createIndexResponse = cirb.execute().actionGet();
		if (!createIndexResponse.isAcknowledged()) {
			logger.warn("Could not create index [{}]", index);
			throw new Exception("Could not create index ["+index+"].");
		}

		logger.trace("/createIndex([{}])", index);
	}
468419
@SuppressWarnings("unchecked")
    private boolean prepareMapping(String index, Map<String, Object> defaultMappings) {
        boolean success = true;

        for (Map.Entry<String, Object> stringObjectEntry : defaultMappings.entrySet()) {
            Map<String, Object> mapping = (Map<String, Object>) stringObjectEntry.getValue();
            if (mapping == null) {
                throw new RuntimeException("type mapping not defined");
            }
            PutMappingRequestBuilder putMappingRequestBuilder = client.admin().indices().preparePutMapping()
                    .setIndices(index);
            putMappingRequestBuilder.setType(stringObjectEntry.getKey());
            putMappingRequestBuilder.setSource(mapping);

            if (log.isLoggable(Level.FINE)) {
                log.fine("Elasticsearch create mapping for index '"
                        + index + " and type '" + stringObjectEntry.getKey() + "': " + mapping);
            }

            PutMappingResponse resp = putMappingRequestBuilder.execute().actionGet();

            if (resp.isAcknowledged()) {
                if (log.isLoggable(Level.FINE)) {
                    log.fine("Elasticsearch mapping for index '"
                            + index + " and type '" + stringObjectEntry.getKey() + "' was acknowledged");
                }
            } else {
                success = false;
                log.warning("Elasticsearch mapping creation was not acknowledged for index '"
                        + index + " and type '" + stringObjectEntry.getKey() + "'");
            }
        }

        return success;
    }
796514
def create_index(self,
                     table: str,
                     field: str,
                     nchars: int = None,
                     indexname: str = None,
                     unique: bool = False) -> Optional[int]:
        """"""
        limit = ""
        if nchars is not None:
            limit = "({})".format(nchars)
        if indexname is None:
            indexname = "_idx_{}".format(field)
        if self.index_exists(table, indexname):
            return None
        uniquestr = "UNIQUE" if unique else ""
        sql = (
            "CREATE {unique} INDEX {indexname} "
            "ON {table} ({field}{limit})".format(
                unique=uniquestr,
                indexname=indexname,
                table=table,
                field=field,
                limit=limit,
            )
        )
        return self.db_exec(sql)
1029839
def create_index(self, index, index_type=GEO2D):
        
        self.logger.info("Adding %s index to stores on attribute: %s" % (index_type, index))
        yield self.collection.create_index([(index, index_type)])
1336356
def create_index(self, key, reindex=True, sparse=False):
        
        warnings.warn('Index support is currently very alpha and is not guaranteed')
        if isinstance(key, (list, tuple)):
            index_name = ','.join(key)
            index_columns = ', '.join('%s text' % f for f in key)
        else:
            index_name = key
            index_columns = '%s text' % key

        table_name = '[%s{%s}]' % (self.name, index_name)
        reindex = reindex or not self._object_exists('table', table_name)

        # Create a table store for the index data
        self.db.execute("""
            create table if not exists {table} (
                id integer primary key,
                {columns},
                foreign key(id) references {collection}(id) on delete cascade on update cascade
            )
        """.format(
            table=table_name,
            collection=self.name,
            columns=index_columns
        ))

        # Create the index
        self.db.execute("""
            create index if not exists [idx.{collection}{{index}}] on {table}({index})
        """.format(
            collection=self.name,
            index=index_name,
            table=table_name,
        ))

        if reindex:
            self.reindex(key)
943034
def create_index(self, cardinality):
        
        DatabaseConnector.create_index(self, cardinality)
        query = "CREATE INDEX idx_{0}_gram_varchar ON _{0}_gram(word varchar_pattern_ops);".format(cardinality)
        self.execute_sql(query)

        if self.lowercase:

            for i in reversed(range(cardinality)):
                if i != 0:
                    query = "CREATE INDEX idx_{0}_gram_{1}_lower ON _{0}_gram(LOWER(word_{1}));".format(cardinality, i)
                    self.execute_sql(query)

            if self.normalize:

                query = "CREATE INDEX idx_{0}_gram_lower_normalized_varchar ON _{0}_gram(NORMALIZE(LOWER(word)) varchar_pattern_ops);".format(cardinality)
                self.execute_sql(query)

            else:

                query = "CREATE INDEX idx_{0}_gram_lower_varchar ON _{0}_gram(LOWER(word) varchar_pattern_ops);".format(cardinality)
                self.execute_sql(query)

        elif self.normalize:

            query = "CREATE INDEX idx_{0}_gram_normalized_varchar ON _{0}_gram(NORMALIZE(word) varchar_pattern_ops);".format(cardinality)
            self.execute_sql(query)
575773
private void createIndex(long idleTime) {
        try {
            this.sessions.createIndex(
                    new Document(SESSION_TTL, 1),
                    new IndexOptions()
                    .expireAfter(idleTime, TimeUnit.SECONDS)
                    .name(SESSION_INDEX_NAME));
        } catch (MongoException ex) {//update idle time
            this.sessions.dropIndex(SESSION_INDEX_NAME);
            this.sessions.createIndex(
                    new Document(SESSION_TTL, 1),
                    new IndexOptions()
                    .expireAfter(idleTime, TimeUnit.SECONDS)
                    .name(SESSION_INDEX_NAME));
        }
    }