I have some code that saves data to Elasticsearch. It runs fine in Python 3.5.2 (cpython), but raises an exception when running on pypi3 6.0.0 (Python 3.5.3). Any ideas why?
File "/opt/venvs/parsedmarc/site-packages/parsedmarc/elastic.py", line 366, in save_forensic_report_to_elasticsearch forensic_doc.save() File "/opt/venvs/parsedmarc/site-packages/elasticsearch_dsl/document.py", line 394, in save index=self._get_index(index), File "/opt/venvs/parsedmarc/site-packages/elasticsearch_dsl/document.py", line 138, in _get_index raise ValidationException('You cannot write to a wildcard index.') elasticsearch_dsl.exceptions.ValidationException: You cannot write to a wildcard index
Looking at document.py, that exception is only supposed to be raised when a save attempt is made on an index name that contains
I set the index name using a
Meta class as as you can see here, and there is not any
* in the
Here's some basic sample code to reproduce the issue:
Note: you must have an Elasticsearch instance running to reproduce the issue.
from elasticsearch_dsl import DocType, Text, connections class _ForensicReportDoc(DocType): class Meta: index = "sample_index" feedback_type = Text() connections.create_connection(hosts=["127.0.0.1"], timeout=20) doc = _ForensicReportDoc(feedback_type="foo") doc.save()