class ElasticsearchUpdateFetcher(AbstractUpdateFetcher):

    # noinspection PyUnusedLocal
    def __init__(self, elasticsearch_client, settings):
        super(ElasticsearchUpdateFetcher, self).__init__()
        self._document_store = ElasticsearchDocumentStore(elasticsearch_client)

    def _fetch_data(self, minimum_timestamp):
        if minimum_timestamp:
            return self._document_store.search_by_minimum_timestamp(minimum_timestamp)
        else:
            return self._document_store.search_all()

    def _to_update(self, data):
        # it is impossible to retrieve delete updates from Elasticsearch. All updates are save only.
        return Update.from_document(data, is_delete=False)
Example #2
0
 def __init__(self, elasticsearch_client, settings):
     document_store = ElasticsearchDocumentStore(elasticsearch_client)
     super(ElasticsearchUpdateApplier, self).__init__(document_store)
     self._elasticsearch_client = elasticsearch_client
Example #3
0
def elasticsearch_document_store(elasticsearch_client):
    return ElasticsearchDocumentStore(elasticsearch_client)
 def __init__(self, elasticsearch_client, settings):
     super(ElasticsearchUpdateFetcher, self).__init__()
     self._document_store = ElasticsearchDocumentStore(elasticsearch_client)