Create an index
@param index index name
@param ignoreErrors don't fail if the index already exists
@param indexSettings index settings if any
@throws IOException In case of error
342762
public void createIndex(String index, boolean ignoreErrors, String indexSettings) throws IOException {
        logger.debug("create index [{}]", index);
        logger.trace("index settings: [{}]", indexSettings);

        try {
            Response response = lowLevelClient.performRequest("PUT", "/" + index,
                    Collections.emptyMap(), createEntity(indexSettings));
            logger.trace("create index response: {}", asMap(response));
        } catch (ResponseException e) {
            if (e.getResponse().getStatusLine().getStatusCode() == 400 &&
                    (e.getMessage().contains("index_already_exists_exception"))) {
                if (!ignoreErrors) {
                    throw new RuntimeException("index already exists");
                }
                logger.trace("index already exists. Ignoring error...");
                return;
            }
            throw e;
        }
        waitForHealthyIndex(index);
    }
1191521
private void addIndex(final String index) throws IOException {

        logger.info("Adding index '{}'...", index);

        String resourcePath = "/" + index;

        if (doesResourceNotExist(resourcePath)) {

            try {
                elasticSearchAdminClient.performRequest(HttpMethod.PUT, resourcePath);

                logger.info("Added '{}' index", index);
            } catch (ResponseException e) {

                boolean errorCreatingIndex = true;

                Response errorResponse = e.getResponse();
                if (errorResponse.getStatusLine().getStatusCode() == HttpStatus.SC_BAD_REQUEST) {
                    JsonNode root = objectMapper.readTree(EntityUtils.toString(errorResponse.getEntity()));
                    String errorCode = root.get("error").get("type").asText();
                    if ("index_already_exists_exception".equals(errorCode)) {
                        errorCreatingIndex = false;
                    }
                }

                if (errorCreatingIndex) {
                    throw e;
                }
            }
        } else {
            logger.info("Index '{}' already exists", index);
        }
    }
1222927
public void readPattern(int[] index) throws IOException {
        int size = index.length;
        for (int i = 0; i < size; ++i)
            index[i] = getInt();
    }
1344825
public static OperationResult failed(long index, long eventIndex, Throwable error) {
    return new OperationResult(index, eventIndex, error, null);
  }
1199862
def create_index(config):
    """"""
    filename = pathlib.Path(config.cache_path) / "index.json"
    index = {"version": __version__}
    with open(filename, "w") as out:
        out.write(json.dumps(index, indent=2))
424157
public void updateIndex() {

        if (!isEnabled()) {
            return;
        }

        final IndexWriterConfig indexWriterConfig = new IndexWriterConfig(new StandardAnalyzer());
        indexWriterConfig
                .setCommitOnClose(true)
                .setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);

        try (IndexWriter indexWriter = new IndexWriter(directory, indexWriterConfig)) {
            final List<IPortletDefinition> portlets = portletRegistry.getAllPortletDefinitions();
            portlets.forEach(portlet -> indexPortlet(portlet, indexWriter));
        } catch (Exception e) {
            logger.error("Unable to update index", e);
        }
    }
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)
285179
def create_index(self, index):
    

    index._path = os.path.join(self.indexes_path, index._name)

    if whoosh.index.exists_in(index._path):
      _whoosh = whoosh.index.open_dir(index._path)
    elif not os.path.exists(index._path):
      os.makedirs(index._path)
      _whoosh = whoosh.index.create_in(index._path, index._schema)
    index._whoosh = _whoosh
1367673
public int indexs(final Integer fromIndex, String... indexWith) {
		int index = INDEX_NONE_EXISTS;
		final String target = ignoreCase ? delegate.get().toLowerCase() : delegate.get();
		
		for (String input : indexWith) {
			String target2 = ignoreCase ? input.toLowerCase() : input;
			if ((index = target.indexOf(target2, fromIndex)) >= 0) {
				return index;
			}
		}
		
		return index;
	}
905658
public void set(long index) throws IOException {
        long pos = index >> 3;
        try {
            lock().acquireUpgradableLock();
            int value = mFile.read(pos);
            int newValue;
            if (value <= 0) {
                newValue = (0x00000080 >> (index & 7));
            }
            else {
                newValue = value | (0x00000080 >> (index & 7));
            }
            if (newValue != value) {
                mFile.write(pos, newValue);
            }
        }
        catch (InterruptedException e) {
            throw new InterruptedIOException();
        }
        finally {
            lock().releaseLock();
        }
    }
798283
public void setValue(int index, int value) throws IOException {
        if (index >= structure.valueSizes.size()) {
            throw new IOException("Index " + index + " is out of range.");
        }
        Bytes.putInt(this.value, structure.valueByteOffsets.get(index), value);
    }
394818
func (c *Client) IndexPutSettings(indices ...string) *IndicesPutSettingsService {
	return NewIndicesPutSettingsService(c).Index(indices...)
}
1191740
def put_settings(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.put_settings(index=self._name, **kwargs)
839434
public void setIndicesRelevants(int[] indicesRelevants) {
        this.indicesRelevants = indicesRelevants;
        // -1 to skip the class attribute
        int numIrrelevantFeatures = this.numAttributes() - this.indicesRelevants.length - 1;
        this.indicesIrrelevants = new int[numIrrelevantFeatures];

        // Infers and sets the set of irrelevant features
        int index = 0;
        int indexRel = 0;
        for(int i = 0; i < numAttributes(); i++){
            if(i != classIndex()) {
                while (indexRel < indicesRelevants.length - 1 &&
                        i > indicesRelevants[indexRel]) indexRel++;
                if (indicesRelevants[indexRel] != i){
                    indicesIrrelevants[index] = i;
                    index++;
                }
            }
        }
    }
806845
private void createIndexesTemplates() {
        try {
            initIndexesTemplates();
            updateIndexesNames();
            Executors.newScheduledThreadPool(1).scheduleAtFixedRate(this::updateIndexesNames, 0, 1, TimeUnit.HOURS);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
    }
160790
public static String readUpdateSettings(String root, String index) {
		return readSettings(root, index, Defaults.UpdateIndexSettingsFileName);
	}
542076
public void refresh(String index) throws IOException {
        logger.debug("refresh index [{}]", index);
        RefreshRequest request = new RefreshRequest();
        if (!isNullOrEmpty(index)) {
            request.indices(index);
        }
        RefreshResponse refresh = client.indices().refresh(request, RequestOptions.DEFAULT);
        logger.trace("refresh response: {}", refresh);
    }