-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Elasticsearch custom mapping fails to insert with write_documents() #293
Comments
Hi @karimjp, thank you for the detailed explanation! Yes, you're right, the The solution you proposed looks good. Similar to the text field, we could add other fields in the field map. Would you like to create a PR? |
Thank you for reviewing @tanaysoni . Sounds good, I'll work on this tonight. |
Resolved by #297. |
for index, row in tqdm(dff.iterrows()): document_store.write_documents(docs) TypeError: init() missing 1 required positional argument: 'content' Can anyone check this error |
Hi all,
I was attempting to insert the following data dictionary structure as shown in the example below using write_documents():
I have a custom mapping, and field mapping definitions for the text field, and name_field as shown below:
This was working at some point but it is breaking now with the following error:
Traceback (most recent call last): File "/Users/karim/PycharmProjects/haystack/playground/solution.py", line 27, in <module> haystack_es.write_documents(haystack_dicts) File "/Users/karim/PycharmProjects/haystack/haystack/database/elasticsearch.py", line 164, in write_documents documents_objects = [Document.from_dict(d) if isinstance(d, dict) else d for d in documents] File "/Users/karim/PycharmProjects/haystack/haystack/database/elasticsearch.py", line 164, in <listcomp> documents_objects = [Document.from_dict(d) if isinstance(d, dict) else d for d in documents] File "/Users/karim/PycharmProjects/haystack/haystack/database/base.py", line 57, in from_dict return cls(**_doc) TypeError: __init__() missing 1 required positional argument: 'text'
Investigating into the issue which appears to generate from this code,
haystack/haystack/database/base.py
Lines 44 to 57 in 5937f9c
I made the following finding:
I coded the following code changes to base.py in order to test a solution for my finding, but it only covers the case for mapping my custom text_field to the expected text field. The name field case doesn't seem to be taken into account by the expected document schema internal to haystack:
The text was updated successfully, but these errors were encountered: