Examples of CountRequestBuilder


Examples of org.elasticsearch.action.count.CountRequestBuilder

    }
  }

  @Override
  public IndexStat getIndexStat() {
    CountRequestBuilder countRequest = client.prepareCount(this.getIndexName())
      .setTypes(this.getIndexType())
      .setQuery(QueryBuilders.matchAllQuery());
    CountResponse response = countRequest.get();
    return new IndexStat(getLastSynchronization(), response.getCount());
  }
View Full Code Here

Examples of org.elasticsearch.action.count.CountRequestBuilder

  @Override
  public Long getCount(String appid, String type) {
    if (StringUtils.isBlank(appid)) {
      return 0L;
    }
    CountRequestBuilder crb = client().prepareCount(appid).
        setQuery(QueryBuilders.matchAllQuery());

    if (type != null) {
      crb.setTypes(type);
    }

    return crb.execute().actionGet().getCount();
  }
View Full Code Here

Examples of org.elasticsearch.action.count.CountRequestBuilder

      for (Map.Entry<String, ?> term : terms.entrySet()) {
        ((AndFilterBuilder) fb).add(FilterBuilders.termFilter(term.getKey(), term.getValue()));
      }
    }
    QueryBuilder qb = QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), fb);
    CountRequestBuilder crb = client().prepareCount(appid).setQuery(qb);

    if (type != null) {
      crb.setTypes(type);
    }

    return crb.execute().actionGet().getCount();
  }
View Full Code Here

Examples of org.elasticsearch.action.count.CountRequestBuilder

        execute(CountAction.INSTANCE, request, listener);
    }

    @Override
    public CountRequestBuilder prepareCount(String... indices) {
        return new CountRequestBuilder(this).setIndices(indices);
    }
View Full Code Here

Examples of org.elasticsearch.action.count.CountRequestBuilder

    }

    @Override
    public <T> long count(SearchQuery query, Class<T> clazz) {
        ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
        CountRequestBuilder countRequestBuilder = client.prepareCount(persistentEntity.getIndexName())
                .setTypes(persistentEntity.getIndexType());
        if(query.getQuery() != null){
            countRequestBuilder.setQuery(query.getQuery());
        }
        return countRequestBuilder.execute().actionGet().count();
    }
View Full Code Here

Examples of org.elasticsearch.client.action.count.CountRequestBuilder

    @Override public SearchScrollRequestBuilder prepareSearchScroll(String scrollId) {
        return new SearchScrollRequestBuilder(this, scrollId);
    }

    @Override public CountRequestBuilder prepareCount(String... indices) {
        return new CountRequestBuilder(this).setIndices(indices);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.