I am trying to connect to a existing index in my local elastic search engine. I am using django-elasticsearch-dsl package. I followed this tutorial to do that. https://github.com/sabricot/django-elasticsearch-dsl
please note that,I already developed my django app[website] with mysql database. I have some unstructured text data indexed in elastic-search. I want to develop this 'advanced search' HTML page for users querying data frpm elasticsearch.
I followed almost everything upto
python manage.py search_index --rebuild but once I excute it it asked Are you sure you want to delete the 'website_data_discovery' indexes? [n/Y]: when I say n it will be aborted.
when I say Y it gives a lengthy error saying django.db.utils.ProgrammingError: Table 'crdc.website_data_discovery' doesn't exist
This is my file structure.
crdc
website
->__pycache__
-> media
->migrations
->static
->templates
->__init__.py
->admin.py
->apps.py
->documnets.py
->forms.py
->models.py
->tests.py
->urls.py
->views.py
manage.py
This is my settings.py/crdc.
###more codes here
INSTALLED_APPS = [
'website.apps.WebsiteConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_elasticsearch_dsl',
]
ELASTICSEARCH_DSL={
'default': {
'hosts': 'localhost:9200'
},
}
###more codes here
This is documents.py/website
from django_elasticsearch_dsl import DocType, Index
from .models import Data_Discovery
data_discovery = Index('website_data_discovery')
data_discovery.settings( number_of_shards = 5, number_of_replicas = 1,)
@data_discovery.doc_type
class Data_DiscoveryDocument(DocType):
class Meta:
model = Data_Discovery
fields = ['extracted_text', 'source_type']
this is models.py/website
from django.db import models
class WebsiteRepository(models.Model):
##### mysql model
class Documents(models.Model):
#### mysql model
class Data_Deposite(models.Model):
#### mysql model
class Data_Discovery(models.Model):
## Elasticsearch model
Any help would be greatly appreciated. Thanks
manage.py makemigrations && manage.py migrate.