public static void removePendingRatings(String userId, ElasticSearchContextListener es) {
   // definitely not  more than 2, but to be safe, take 100...
   SearchResponse response =
       es.searchrequest(INDEX_NAME, QueryBuilders.matchQuery(ES_STATUS, ES_STATUS_PENDING), 0, 100)
           .actionGet();
   for (SearchHit hit : response.getHits()) {
     es.deleteRequest(INDEX_NAME, hit.getId()).actionGet();
   }
 }
  private static String getPendingItemId(
      ElasticSearchContextListener es, String userId, String memeId) {
    String pendingItemId = null;

    SearchResponse response =
        es.searchrequest(
                INDEX_NAME,
                QueryBuilders.boolQuery()
                    .must(QueryBuilders.matchQuery(ES_USER_ID, userId))
                    .must(QueryBuilders.matchQuery(ES_MEME_ID, memeId))
                    .must(QueryBuilders.matchQuery(ES_STATUS, ES_STATUS_PENDING)),
                0,
                1)
            .actionGet();

    if (response.getHits().getTotalHits() > 0) {
      pendingItemId = response.getHits().getAt(0).id();
    }

    return pendingItemId;
  }
 public static long getTotalNumberOfRatings(ElasticSearchContextListener es) {
   SearchResponse resp =
       es.searchrequest(INDEX_NAME, QueryBuilders.matchAllQuery(), 0, 0).actionGet();
   return resp.getHits().getTotalHits();
 }