Why does elasticsearch raise an exception on pypy but not cpython?

I have some code <https://github.com/domainaware/parsedmarc/blob/master/parsedmarc/elastic.py#...> that saves data to Elasticsearch. It runs fine in Python 3.5.2 (cpython), but raises an exception when running on pypy 3 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 I also asked Stack Overflow. You can answer there for internet points. :) https://stackoverflow.com/questions/51368293/why-does-elasticsearch-raise- elasticsearch-dsl-exceptions-validationexception-y

Looking at document.py <https://github.com/elastic/elasticsearch-dsl-py/blob/master/elasticsearch_ds...>, 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 <https://github.com/domainaware/parsedmarc/blob/master/parsedmarc/elastic.py#...>, 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() On Tue, Jul 17, 2018 at 4:00 AM, Armin Rigo <armin.rigo@gmail.com> wrote:

Looking at the exception, I would say there's something up with how elasticsearch_dsl is creating the request to ElasticSearch. If you look at the code where the exception is being raised ( https://github.com/elastic/elasticsearch-dsl-py/blob/master/elasticsearch_ds...), its done if an asterisk (*) is found in the index name. Maybe try creating an issue on their Github? On Tue, Jul 17, 2018 at 11:37 PM, Sean Whalen <whalenster@gmail.com> wrote:
-- Regards, Najam Ahmed Ansari

Looking at document.py <https://github.com/elastic/elasticsearch-dsl-py/blob/master/elasticsearch_ds...>, 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 <https://github.com/domainaware/parsedmarc/blob/master/parsedmarc/elastic.py#...>, 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() On Tue, Jul 17, 2018 at 4:00 AM, Armin Rigo <armin.rigo@gmail.com> wrote:

Looking at the exception, I would say there's something up with how elasticsearch_dsl is creating the request to ElasticSearch. If you look at the code where the exception is being raised ( https://github.com/elastic/elasticsearch-dsl-py/blob/master/elasticsearch_ds...), its done if an asterisk (*) is found in the index name. Maybe try creating an issue on their Github? On Tue, Jul 17, 2018 at 11:37 PM, Sean Whalen <whalenster@gmail.com> wrote:
-- Regards, Najam Ahmed Ansari
participants (3)
-
Armin Rigo
-
Najam Ahmed Ansari
-
Sean Whalen