Package com.dotcms.repackage.org.elasticsearch.client

Examples of com.dotcms.repackage.org.elasticsearch.client.IndicesAdminClient


        final String timeStamp=timestampFormatter.format(new Date());

        final String workingIndex=ES_WORKING_INDEX_NAME+"_"+timeStamp;
        final String liveIndex=ES_LIVE_INDEX_NAME+ "_" + timeStamp;

            final IndicesAdminClient iac = new ESClient().getClient().admin().indices();

            createContentIndex(workingIndex,0);
            createContentIndex(liveIndex,0);

            IndiciesInfo info=new IndiciesInfo();
View Full Code Here


                // index names for new index
                final String workingIndex=ES_WORKING_INDEX_NAME + "_" + timeStamp;
                final String liveIndex=ES_LIVE_INDEX_NAME + "_" + timeStamp;

                final IndicesAdminClient iac = new ESClient().getClient().admin().indices();

                createContentIndex(workingIndex);
                createContentIndex(liveIndex);

                IndiciesInfo info=APILocator.getIndiciesAPI().loadIndicies();
View Full Code Here

    }
  }

  public boolean optimize(List<String> indexNames) {
    try {
      IndicesAdminClient iac = new ESClient().getClient().admin().indices();

      OptimizeRequest req = new OptimizeRequest(indexNames.toArray(new String[indexNames.size()]));

      OptimizeResponse res = iac.optimize(req).get();

      Logger.info(this.getClass(), "Optimizing " + indexNames + " :" + res.getSuccessfulShards() + "/" + res.getTotalShards()
          + " shards optimized");
      return true;
    } catch (Exception e) {
View Full Code Here

    }

    try {
            AdminLogger.log(this.getClass(), "delete", "Trying to delete index: " + indexName);

      IndicesAdminClient iac = new ESClient().getClient().admin().indices();
      DeleteIndexRequest req = new DeleteIndexRequest(indexName);
      DeleteIndexResponse res = iac.delete(req).actionGet();

            AdminLogger.log(this.getClass(), "delete", "Index: " + indexName + " deleted.");

            return res.isAcknowledged();
    } catch (Exception e) {
View Full Code Here

    Client client = new ESClient().getClient();

    try {
      if (!indexExists) {
        final IndicesAdminClient iac = new ESClient().getClient().admin().indices();

        createIndex(index);
      }

      ZipInputStream zipIn=new ZipInputStream(new FileInputStream(backupFile));
View Full Code Here

  public synchronized CreateIndexResponse createIndex(String indexName, String settings, int shards) throws ElasticSearchException, IOException {

    AdminLogger.log(this.getClass(), "createIndex",
                "Trying to create index: " + indexName + " with shards: " + shards);

        IndicesAdminClient iac = new ESClient().getClient().admin().indices();

    if(shards <1){
      try{
        shards = Integer.parseInt(System.getProperty("es.index.number_of_shards"));
      }catch(Exception e){}
    }
    if(shards <1){
      try{
        shards = Config.getIntProperty("es.index.number_of_shards");
      }catch(Exception e){}
    }

    if(shards <0){
      shards=1;
    }

    //default settings, if null
    if(settings ==null){
      settings = getDefaultIndexSettings(shards);
    }
    Map map = new ObjectMapper().readValue(settings, LinkedHashMap.class);
    map.put("number_of_shards", shards);


        // create actual index
    CreateIndexRequestBuilder cirb = iac.prepareCreate(indexName).setSettings(map);
        CreateIndexResponse createIndexResponse = cirb.execute().actionGet();

        AdminLogger.log(this.getClass(), "createIndex",
                "Index created: " + indexName + " with shards: " + shards);
View Full Code Here

    //Seems like the method is not longer used
    // but I still will add the log just in case
        AdminLogger.log(this.getClass(), "createIndex",
                "Trying to create index: " + indexName + " with shards: " + shards);

        IndicesAdminClient iac = new ESClient().getClient().admin().indices();

    if(shards <1){
      try{
        shards = Integer.parseInt(System.getProperty("es.index.number_of_shards"));
      }catch(Exception e){}
    }
    if(shards <1){
      try{
        shards = Config.getIntProperty("es.index.number_of_shards");
      }catch(Exception e){}
    }

    if(shards <0){
      shards=1;
    }

    //default settings, if null
    if(settings ==null){
      settings = getDefaultIndexSettings(shards);
    }


        // create actual index
    iac.prepareCreate(indexName).setSettings(settings).addMapping(type, mapping).execute();

        AdminLogger.log(this.getClass(), "createIndex",
                "Index created: " + indexName + " with shards: " + shards);

    return null;
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.elasticsearch.client.IndicesAdminClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.