-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: avoid conflicts with opensearch / elasticsearch magic attributes during bulk requests #5113
Conversation
Pull Request Test Coverage Report for Build 5486440683
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few notes. Let's note that methods in this class need to be broken down, simplified and better unit tested. We can do that in a new PR dedicated to simplification and better unit tests for this class.
if _doc[self.embedding_field] is not None: | ||
if type(_doc[self.embedding_field]) == np.ndarray: | ||
_doc[self.embedding_field] = _doc[self.embedding_field].tolist() | ||
if _source[self.embedding_field] is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about something like:
if isinstance(_source.get(self.embedding_field), np.ndarray):
_source[self.embedding_field] = _source[self.embedding_field].tolist()
Would that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will change that.
_doc[k] = v | ||
_doc.pop("meta") | ||
documents_to_index.append(_doc) | ||
if "meta" in _source.keys(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
_source.update(_source.pop("meta", {}))
Would that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have to take care of _source["meta] == None
. Besides that it would work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Related Issues
Proposed Changes:
How did you test it?
Notes for the reviewer
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.