Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-70125

Creating DDL entries fields with empty "" values causes indexation errors when using Elasticsearch

    Details

      Description

      Elasticseach cannot parse empty strings, so when non-required fields are left empty, indexation fails.

      I have not checked if Solr is affected too.

      Steps to reproduce:

      1) Create a data definition using data-definition.json
      2) Create a DDL using the previous definition.
      3) Create an entry (1) with all fields filled. The entry is saved and it can be searched.
      4) Create an entry (2) with empty date fields.

      Expected result: the entry is saved and it can be searched.

      Actual result: the entry is saved, but indexation fails (see exception bellow) and it can not be searched.

      Liferay log
      13:00:43,144 ERROR [liferay/search_writer/SYSTEM_ENGINE-4][ElasticsearchUpdateDocumentCommandImpl:50] failure in bulk execution:_[1]: index [liferay-20114], type [LiferayDocumentType], id [com.liferay.dynamic.data.lists.model.DDLRecord_PORTLET_34267], message [MapperParsingException[failed to parse [ddm__keyword__34256__FechaInicio_ja_JP_sortable]]; nested: IllegalArgumentException[Invalid format: ""];] [Sanitized]
      13:00:43,147 WARN  [liferay/search_writer/SYSTEM_ENGINE-4][ProxyMessageListener:84] com.liferay.portal.kernel.search.SearchException: failure in bulk execution:_[1]: index [liferay-20114], type [LiferayDocumentType], id [com.liferay.dynamic.data.lists.model.DDLRecord_PORTLET_34267], message [MapperParsingException[failed to parse [ddm__keyword__34256__FechaInicio_ja_JP_sortable]]; nested: IllegalArgumentException[Invalid format: ""];] [Sanitized]
      com.liferay.portal.kernel.search.SearchException: failure in bulk execution:_[1]: index [liferay-20114], type [LiferayDocumentType], id [com.liferay.dynamic.data.lists.model.DDLRecord_PORTLET_34267], message [MapperParsingException[failed to parse [ddm__keyword__34256__FechaInicio_ja_JP_sortable]]; nested: IllegalArgumentException[Invalid format: ""];] [Sanitized]
              at com.liferay.portal.search.elasticsearch.internal.ElasticsearchUpdateDocumentCommandImpl.updateDocument(ElasticsearchUpdateDocumentCommandImpl.java:71)
              at com.liferay.portal.search.elasticsearch.internal.ElasticsearchIndexWriter.updateDocument(ElasticsearchIndexWriter.java:253)
              at sun.reflect.GeneratedMethodAccessor573.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at com.liferay.portal.kernel.messaging.proxy.ProxyRequest.execute(ProxyRequest.java:86)
              at com.liferay.portal.kernel.messaging.proxy.ProxyMessageListener.receive(ProxyMessageListener.java:54)
              at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
              at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:52)
              at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:756)
              at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:667)
              at java.lang.Thread.run(Thread.java:745)
      
      Elasticsearch log
      java.lang.IllegalArgumentException: mapper [ddm__keyword__33603__Fechafj3x_ja_JP] cannot be changed from type [string] to [date]
      	at org.elasticsearch.index.mapper.MappedFieldType.checkTypeName(MappedFieldType.java:234)
      	at org.elasticsearch.index.mapper.MappedFieldType.checkCompatibility(MappedFieldType.java:246)
      	at org.elasticsearch.index.mapper.FieldTypeLookup.checkCompatibility(FieldTypeLookup.java:168)
      	at org.elasticsearch.index.mapper.MapperService.checkMappersCompatibility(MapperService.java:402)
      	at org.elasticsearch.index.mapper.MapperService.checkMappersCompatibility(MapperService.java:411)
      	at org.elasticsearch.index.mapper.DocumentMapper.merge(DocumentMapper.java:390)
      	at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.applyRequest(MetaDataMappingService.java:261)
      	at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.execute(MetaDataMappingService.java:230)
      	at org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:458)
      	at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:762)
      	at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231)
      	at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

      Solution Notes
      Requires a full reindex to let the new index mapping settings take effect.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                raven.song Raven Song
                Reporter:
                alberto.montero Alberto Montero
                Participants of an Issue:
                Recent user:
                Csaba Turcsan
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 50 weeks, 1 day ago

                  Packages

                  Version Package
                  7.0.0 DXP FP14
                  7.0.0 DXP SP3
                  7.0.3 CE GA4
                  7.0.X EE
                  Master