Open yadangsmith opened 6 years ago
Am also facing the same issue while using django_elasticsearch_dsl package django.db.utils.OperationalError: no such table: table_name. Anyone please help me to solve this issue. Is there anyother way to use ElasticSearch as backend without DB
I Am also facing the same issue while using django_elasticsearch_dsl package django.db.utils.OperationalError: no such table: table_name.
Any update on this
hi, I love the pkg ,but encounter a problem:
env: Django (1.11.1) django-elasticsearch-dsl (0.4.4) elasticsearch (6.1.1) elasticsearch-dsl (6.1.0)
in django settings.py : ELASTICSEARCH_DSL = { 'default': { 'hosts': '10.11.96.28:9200' }, }
Database
https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } models.py: from django.db import models
class News(models.Model): id=models.IntegerField(primary_key=True) title=models.CharField(max_length=100) author=models.CharField(max_length=100) releasetime=models.DateTimeField(auto_now_add=True) content=models.TextField() keywords=models.CharField(max_length=100) cattegory=models.IntegerField(choices=[ (1, "Notice"), (2, "News"), (3, "Else"), ])
the documents.py: from django_elasticsearch_dsl import DocType, Index from .models import News
Name of the Elasticsearch index
hidbanews = Index('hidba_news')
See Elasticsearch Indices API reference for available settings
hidbanews.settings( number_of_shards=1, number_of_replicas=2 )
@hidbanews.doc_type class NewsDocument(DocType): class Meta: model = News # The model associated with this DocType
when I search data from NewsDocument, why it access the sqlite3, what's wrong ,how to solve the problem?
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "", line 1, in
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/models/query.py", line 226, in repr
data = list(self[:REPR_OUTPUT_SIZE + 1])
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/models/query.py", line 250, in iter
self._fetch_all()
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/models/query.py", line 1103, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/models/query.py", line 53, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 886, in execute_sql
raise original_exception
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 876, in execute_sql
cursor.execute(sql, params)
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/backends/utils.py", line 80, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/utils.py", line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/app/pyenv/versions/3.6.2/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: knows_news