cookiecutter-django-shop
cookiecutter-django-shop copied to clipboard
Elasticsearch broken on fresh Docker install
What happened?
Full text search throws:
NotFoundError at /en/search/
NotFoundError(404, 'IndexMissingException[[paintbypattern.en.products] missing]', 'IndexMissingException[[paintbypattern.en.products] missing]')
./manage.py search_index --rebuild fails with a MapperParsingException, see full traceback below. I'm unsure of how to actually modify this or what exactly it is looking for when it makes this mapping. If anybody could let me know so I can experiment on my own that would be appreciated.
I'm also noticing that worker.py is attempting to call an unknown command called rebuild_index
:
worker_1 | File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 105, in call_command
worker_1 | raise CommandError("Unknown command: %r" % command_name)
worker_1 | django.core.management.base.CommandError: Unknown command: 'rebuild_index'
What should've happened instead?
Search function should have executed or and presented no results.
Steps to reproduce
Install a fresh Django-Shop instance and try to search.
Also try to rebuild the search index with ./manage.py search_index --rebuild
Ubuntu 20.04 on AWS, Docker version 20.10.3, build 48d30b5, docker-compose version 1.28.2, build 67630359, python 3.6.6
Elasticsearch enabled. //: # (* Logs)
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.6/site-packages/django_elasticsearch_dsl/management/commands/search_index.py", line 159, in handle
self._rebuild(models, options)
File "/usr/local/lib/python3.6/site-packages/django_elasticsearch_dsl/management/commands/search_index.py", line 139, in _rebuild
self._create(models, options)
File "/usr/local/lib/python3.6/site-packages/django_elasticsearch_dsl/management/commands/search_index.py", line 106, in _create
index.create()
File "/usr/local/lib/python3.6/site-packages/elasticsearch_dsl/index.py", line 280, in create
index=self._name, body=self.to_dict(), **kwargs
File "/usr/local/lib/python3.6/site-packages/elasticsearch/client/utils.py", line 152, in _wrapped
return func(*args, params=params, headers=headers, **kwargs)
File "/usr/local/lib/python3.6/site-packages/elasticsearch/client/indices.py", line 124, in create
"PUT", _make_path(index), params=params, headers=headers, body=body
File "/usr/local/lib/python3.6/site-packages/elasticsearch/transport.py", line 415, in perform_request
raise e
File "/usr/local/lib/python3.6/site-packages/elasticsearch/transport.py", line 388, in perform_request
timeout=timeout,
File "/usr/local/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 273, in perform_request
self._raise_error(response.status, raw_data)
File "/usr/local/lib/python3.6/site-packages/elasticsearch/connection/base.py", line 323, in _raise_error
status_code, error_message, additional_info
elasticsearch.exceptions.RequestError: RequestError(400, 'MapperParsingException[mapping [properties]]; nested: MapperParsingException[Root type mapping not empty after parsing! Remaining fields: [product_type : {type=text}] [id : {type=integer}] [body : {analyzer=default_analyzer, type=text}] [product_code : {boost=3, type=keyword}] [product_name : {boost=2, type=text}]]; ', 'MapperParsingException[mapping [properties]]; nested: MapperParsingException[Root type mapping not empty after parsing! Remaining fields: [product_type : {type=text}] [id : {type=integer}] [body : {analyzer=default_analyzer, type=text}] [product_code : {boost=3, type=keyword}] [product_name : {boost=2, type=text}]]; ')