Exception on ElastiSearch in Discovery

HI @regis ,
while searching any course , the dashboard is giving error that nothing is found and in logs I am getting below exception , can you please help out here.

Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/search/elastic.py", line 600, in search
    es_response = self._es.search(
  File "/openedx/venv/lib/python3.8/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/elasticsearch/client/__init__.py", line 530, in search
    _, data = self.transport.perform_request('GET', _make_path(index,
  File "/openedx/venv/lib/python3.8/site-packages/elasticsearch/transport.py", line 307, in perform_request
    status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  File "/openedx/venv/lib/python3.8/site-packages/elasticsearch/connection/http_urllib3.py", line 93, in perform_request
    self._raise_error(response.status, raw_data)
  File "/openedx/venv/lib/python3.8/site-packages/elasticsearch/connection/base.py", line 105, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.TransportError: TransportError(406, 'Content-Type header [] is not supported')
2021-11-16 07:47:23,484 ERROR 7 [search.views] [user 3] [ip 172.20.0.1] views.py:228 - Search view exception when searching for  for user 3: TransportError(406, 'Content-Type header [] is not supported', {'error': 'Content-Type header [] is not supported', 'status': 406})
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/search/views.py", line 192, in course_discovery
    results = course_discovery_search(
  File "/openedx/venv/lib/python3.8/site-packages/search/api.py", line 97, in course_discovery_search
    results = searcher.search(
  File "/openedx/venv/lib/python3.8/site-packages/search/elastic.py", line 600, in search
    es_response = self._es.search(
  File "/openedx/venv/lib/python3.8/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/elasticsearch/client/__init__.py", line 530, in search
    _, data = self.transport.perform_request('GET', _make_path(index,
  File "/openedx/venv/lib/python3.8/site-packages/elasticsearch/transport.py", line 307, in perform_request
    status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  File "/openedx/venv/lib/python3.8/site-packages/elasticsearch/connection/http_urllib3.py", line 93, in perform_request
    self._raise_error(response.status, raw_data)
  File "/openedx/venv/lib/python3.8/site-packages/elasticsearch/connection/base.py", line 105, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.TransportError: TransportError(406, 'Content-Type header [] is not supported')

Traceback (most recent call last):
File “/openedx/venv/lib/python3.8/site-packages/search/elastic.py”, line 600, in search
es_response = self._es.search(
File “/openedx/venv/lib/python3.8/site-packages/elasticsearch/client/utils.py”, line 69, in _wrapped
return func(*args, params=params, **kwargs)
File “/openedx/venv/lib/python3.8/site-packages/elasticsearch/client/**init**.py”, line 530, in search
_, data = self.transport.perform_request(‘GET’, _make_path(index,
File “/openedx/venv/lib/python3.8/site-packages/elasticsearch/transport.py”, line 307, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File “/openedx/venv/lib/python3.8/site-packages/elasticsearch/connection/http_urllib3.py”, line 93, in perform_request
self._raise_error(response.status, raw_data)
File “/openedx/venv/lib/python3.8/site-packages/elasticsearch/connection/base.py”, line 105, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.TransportError: TransportError(406, ‘Content-Type header [] is not supported’)
2021-11-16 07:47:23,484 ERROR 7 [search.views] [user 3] [ip 172.20.0.1] views.py:228 - Search view exception when searching for for user 3: TransportError(406, ‘Content-Type header [] is not supported’, {‘error’: ‘Content-Type header [] is not supported’, ‘status’: 406})
Traceback (most recent call last):
File “/openedx/venv/lib/python3.8/site-packages/search/views.py”, line 192, in course_discovery
results = course_discovery_search(
File “/openedx/venv/lib/python3.8/site-packages/search/api.py”, line 97, in course_discovery_search
results = searcher.search(
File “/openedx/venv/lib/python3.8/site-packages/search/elastic.py”, line 600, in search
es_response = self._es.search(
File “/openedx/venv/lib/python3.8/site-packages/elasticsearch/client/utils.py”, line 69, in _wrapped
return func(*args, params=params, **kwargs)
File “/openedx/venv/lib/python3.8/site-packages/elasticsearch/client/**init**.py”, line 530, in search
_, data = self.transport.perform_request(‘GET’, _make_path(index,
File “/openedx/venv/lib/python3.8/site-packages/elasticsearch/transport.py”, line 307, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File “/openedx/venv/lib/python3.8/site-packages/elasticsearch/connection/http_urllib3.py”, line 93, in perform_request
self._raise_error(response.status, raw_data)
File “/openedx/venv/lib/python3.8/site-packages/elasticsearch/connection/base.py”, line 105, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.TransportError: TransportError(406, ‘Content-Type header [] is not supported’)

Hello @Tauseeef,

It will be great if you describe your position in a better way like what version of Tutor you are using, What steps you have done till now, etc.

Please provide this information so that people here can check and help you.

1 Like

The error is occurring while I try to search the course from UI, I have enabled the discovery plugin and intialized it as well.
the error occurred when I tried to deploy koa but even if I go with simple images from overhang registry , I do not get any exception but search still gives me error that “We couldn’t find any results for “demo”.”.

Anything that I am missing here ?

@regis

  File "course_discovery/wsgi.py", line 20, in <module>
    application = get_wsgi_application()  # pylint: disable=invalid-name
  File "/openedx/venv/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/openedx/venv/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/openedx/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 79, in __getattr__
    self._setup(name)
  File "/openedx/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 66, in _setup
    self._wrapped = Settings(settings_module)
  File "/openedx/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 157, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/discovery/./course_discovery/settings/tutor/production.py", line 25, in <module>
    ELASTICSEARCH_DSL['default'].update({
NameError: name 'ELASTICSEARCH_DSL' is not defined
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***

I am getting above error in discovery startup logs , any idea where to define this ELASTICSEARCH_DSL
?

@Tauseeef you really need to tell us which tutor version you are running, along with which plugins. Also, describe how you customised your platform. You mention that you are running Koa: are you aware that Koa is only supported for tutor less than v12?