Package com.dotcms.content.elasticsearch.util

Examples of com.dotcms.content.elasticsearch.util.ESClient


  /**
   * Inits the indexs
   */
  public  synchronized void checkAndInitialiazeIndex() {
    new ESClient().getClient(); // this will call initNode
    try {
      // if we don't have a working index, create it
      if (!indexReady())
        initIndex();
    } catch (Exception e) {
View Full Code Here


        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

      if(content==null || !UtilMethods.isSet(content.getIdentifier())) return;

      Runnable indexAction=new Runnable() {
            public void run() {
                try {
                    Client client=new ESClient().getClient();
                    BulkRequestBuilder req = (bulk==null) ? client.prepareBulk() : bulk;

                    // http://jira.dotmarketing.net/browse/DOTCMS-6886
                    // check for related content to reindex
                    List<Contentlet> contentToIndex=new ArrayList<Contentlet>();
View Full Code Here

  private void removeContentFromIndex(final Contentlet content, final boolean onlyLive, final List<Relationship> relationships) throws DotHibernateException {
     Runnable indexRunner = new Runnable() {
              public void run() {
                try {
                    String id=content.getIdentifier()+"_"+content.getLanguageId();
                    Client client=new ESClient().getClient();
                    BulkRequestBuilder bulk=client.prepareBulk();
                    IndiciesInfo info=APILocator.getIndiciesAPI().loadIndicies();

                    bulk.add(client.prepareDelete(info.live, "content", id));
                    if(info.reindex_live!=null)
View Full Code Here

          idxs.add(info.reindex_live);
      String[] idxsArr=new String[idxs.size()];
      idxsArr=idxs.toArray(idxsArr);

      // deleting those with the specified structure inode
      new ESClient().getClient().prepareDeleteByQuery()
              .setIndices(idxsArr)
              .setQuery(QueryBuilders.queryString("+structurename:"+structureName))
              .execute().actionGet();
  }
View Full Code Here

    /**
     * Returns a list of dotcms working and live indices.
     * @return
     */
    public List<String> listDotCMSIndices() {
        Client client=new ESClient().getClient();
        Map<String,IndexStatus> indices=APILocator.getESIndexAPI().getIndicesAndStatus();
        List<String> indexNames=new ArrayList<String>();

        for(String idx : indices.keySet())
            if(isDotCMSIndexName(idx))
View Full Code Here

    /**
     * returns all indicies and status
     * @return
     */
    public Map<String,IndexStatus> getIndicesAndStatus() {
        Client client=new ESClient().getClient();
        return client.admin().indices().status(new IndicesStatusRequest()).actionGet().getIndices();
    }
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();
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.");
View Full Code Here

TOP

Related Classes of com.dotcms.content.elasticsearch.util.ESClient

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.