Created
March 25, 2019 15:12
-
-
Save aplz/62e52764bdcd0fb10ff5151f377c8e16 to your computer and use it in GitHub Desktop.
elasticsearch - generator for bulk ingestion with upserts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for doc in collection: | |
yield { | |
'_id': id, '_type': TYPE, | |
'_index': index, | |
# with "doc_as_upsert": True, the document is either updated | |
# or created if it does not already exist. | |
'_op_type': 'update', 'doc': doc, "doc_as_upsert": True | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment