def get_count_for_collection(doc_type, index=None): """ :param doc_type: e.g. CFG_PUB_TYPE or CFG_DATA_TYPE :param index: name of index to use. :return: the number of records in that collection """ return es.count(index=index, doc_type=doc_type)
def is_record_in_db(obj, eng): """Checks if record is in database""" return es.count(q='dois.value:"%s"' % (get_first_doi(obj),))['count'] > 0
def number_of_records(collection_name): """Returns number of records for the collection.""" index = collection_to_index(collection_name) result = es.count(index=index) return result['count']