def refresh_index(cls, document_types): """ Refresh the index on Elastic Search :param document_types: Document Types """ IndexBacklog = Pool().get('elasticsearch.index_backlog') conn = IndexBacklog._get_es_connection() for document_type in document_types: conn.indices.refresh(Transaction().cursor.dbname)
def update_mapping(cls, document_types): """ Update the mapping on the server side """ IndexBacklog = Pool().get('elasticsearch.index_backlog') conn = IndexBacklog._get_es_connection() for document_type in document_types: conn.indices.put_mapping( document_type.model.model, # Type {'properties': json.loads(document_type.mapping)}, [Transaction().cursor.dbname], # Index )