Skip to content

Commit

Permalink
Merge branch 'main' into renovate/wolfi-(versioned)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanstory authored Dec 5, 2024
2 parents 40a9fcc + 9c72b45 commit 02c8b3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions connectors/es/sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,8 @@ async def get_docs(self, generator, skip_unchanged_documents=False):
if count % self.display_every == 0:
self._log_progress()

doc_id = doc["id"] = doc.pop("_id")
doc_id = doc.pop("_id")
doc["id"] = str(doc_id)

if self.basic_rule_engine and not self.basic_rule_engine.should_ingest(
doc
Expand Down Expand Up @@ -660,7 +661,8 @@ async def get_docs_incrementally(self, generator):
if count % self.display_every == 0:
self._log_progress()

doc_id = doc["id"] = doc.pop("_id")
doc_id = doc.pop("_id")
doc["id"] = str(doc_id)

if self.basic_rule_engine and not self.basic_rule_engine.should_ingest(
doc
Expand Down Expand Up @@ -737,7 +739,8 @@ async def get_access_control_docs(self, generator):
if count % self.display_every == 0:
self._log_progress()

doc_id = doc["id"] = doc.pop("_id")
doc_id = doc.pop("_id")
doc["id"] = str(doc_id)
doc_exists = doc_id in existing_ids

if doc_exists:
Expand Down
6 changes: 4 additions & 2 deletions tests/test_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,17 @@ async def _dl(doit=True, timestamp=None):
def index_operation(doc):
# deepcopy as get_docs mutates docs
doc_copy = deepcopy(doc)
doc_id = doc_copy["id"] = doc_copy.pop("_id")
doc_id = doc_copy.pop("_id")
doc_copy["id"] = str(doc_id)

return {"_op_type": "index", "_index": INDEX, "_id": doc_id, "doc": doc_copy}


def update_operation(doc):
# deepcopy as get_docs mutates docs
doc_copy = deepcopy(doc)
doc_id = doc_copy["id"] = doc_copy.pop("_id")
doc_id = doc_copy.pop("_id")
doc_copy["id"] = str(doc_id)

return {"_op_type": "update", "_index": INDEX, "_id": doc_id, "doc": doc_copy}

Expand Down

0 comments on commit 02c8b3f

Please sign in to comment.