Exception always raised when saving a document using pypy but not when using cpython
See original GitHub issueI 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 index
variable.
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()
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Why does elasticsearch-dsl-py raise an exception on pypy but ...
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...
Read more >Why shouldn't I use PyPy over CPython if PyPy is 6.3 times ...
For an initial backup, which does lots of file chunking, pypy is great. But for subsequent backups which are mostly just updating timestamps,...
Read more >How to fix Python KeyError Exceptions in simple steps?
Know about Python KeyError Exception. And learn how to handle exceptions in Python. A detailed guide to Errors and Exceptions in Python.
Read more >How to perform exception handling in Python | Packt Hub
This example deals with opening the 'example.txt'. In such cases, when the called upon file is not found or does not exist then...
Read more >8. Errors and Exceptions — Python 3.11.1 documentation
The error is caused by (or at least detected at) the token preceding the arrow: in the example, the error is detected at...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for the report. The code that is responsible for setting the index name has been moved to
class Index
in6.2.0
so now you have to do:Since it works for you in one environment and not another one is it possible that you have different versions?
Hope this helps!
While using elasticsearch-dsl 6.3.1 with elasticsearch 6.3.1. This is error is re-occuring, as the response dictionary doesnot have a key result, there is a key created with value True/False. This bug has been fixed locally, should create a PR