Issue
- When Liferay starts up, we observes the following error:
ERROR [liferay/schedulerdispatch-5][ElasticsearchIndexSearcher:169] java.lang.RuntimeException: org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [query], all shards failed; shardFailures {[uLTKGY0yQGOhY7um23rIOw][liferay-20101][0]: RemoteTransportException[[node-1][10.241.20.11:9300][indices:data/read/search[phase/query]]]; nested: IllegalArgumentException[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 [localizedtitleenUS_sortable] in order to load field data by uninverting the inverted index. Note that this can use significant memory.]; } ......
Environment
- Liferay DXP 7.2
Resolution
- If your ES cluster do not serve other applications, you may add
action.auto_create_index:false
to elasticsearch.yml then do a full reindex. - Possible root cause: When someone executes a full reindex with deletes the index (and therefore the mappings) and then it recreates the index and then sets the mappings. In theory, between index creation and the put of the "catch all" dynamic template (which happens after index creation), a document was sent to elastic with these fields and the mapping was auto-created.
Additional Information
- Please see Elastic's documentation about this setting.
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/index-management-settings.html