public long count(String indexName){
  return count(QueryBuilders.constantScoreQuery(QueryBuilders.matchAllQuery()),indexName);
}

public long count ( String indexName ) { return count ( QueryBuilders . constantScoreQuery ( QueryBuilders . matchAllQuery ( ) ) , indexName ) ; }
get the number of documents in the search index
