Open edX elasticsearch.exceptions.RequestError: RequestError(400,

Hi,

yesterday the server run out of space and elasticsearch stopped working. I added space but the openedx search showed only some of the courses. I tried to fix the problem and I run the command
tutor local exec elasticsearch curl -X DELETE 'http://localhost:9200/_all but now the message An error occurred when searching for “” appears on search page. In lms logs the error is

elasticsearch.exceptions.RequestError: RequestError(400, ‘search_phase_execution_exception’, ‘Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [org] in order to load field data by uninverting the inverted index. Note that this can use significant memory.’)

When I try to reindex the courses one by one the platform shows that the task was successful but the problem remains.

I tried everything I have found but without success.

Please, how can I solve the problem?

Hi

I had a similar issue after I removed some indexes to get rid of the legacy unneeded data.

This is how I resolved it:

  1. Removed all the indexes (curl like in your example)
  2. Removed the elastic search volume (just in case :slightly_smiling_face:)
  3. Redeployed the instance (most of the indexes were created after the deployment was done, the courseware_content index was the only one missing)
  4. [Optional] Tested the indexing with the “Reindex” button in the Studio - reindexed course appeared on the /courses page, no errors in the LMS logs
  5. Used the ./manage.py cms reindex_course --all in the CMS shell to update all the courses in the indexes. Grab some coffee, it could take a while.