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

Incorrect processing of escaped characters in overridden Type Mappings

    Details

      Description

      1. Navigate Control Panel | System Settings | Platform | Search | System Scope | Elasticsearch 7
      2. Into Override Type Mappings paste tweaked original
      {
            "dynamic_templates" : [
              {
                "template_en" : {
                  "match_pattern" : "regex",
                  "mapping" : {
                    "search_analyzer" : "liferay_analyzer_en",
                    "analyzer" : "english",
                    "term_vector" : "with_positions_offsets",
                    "store" : true,
                    "type" : "text"
                  },
                  "match_mapping_type" : "string",
                  "match" : "\\w+_en\\b|\\w+_en_[A-Z]{2}\\b"
                }
              },
            ],
            "date_detection" : false,
            "properties" : {
              /*... */
            }
      }
      
      1. Save configuration
      2. Go to Control Panel | Search | Index Acions | Reindex all search indexes
      3. There is error in the log:
      2020-09-01 13:20:47.696 ERROR [liferay/background_task-2][SearchEngineInitializer:184] Error encountered while reindexing
      ElasticsearchStatusException[Elasticsearch exception [type=parse_exception, reason=Failed to parse content to map]]; nested: ElasticsearchException[Elasticsearch exception [type=json_parse_exception, reason=Unrecognized character escape 'w' (code 119)_ at [Source: [email protected]; line: 94, column: 26]]]; [Sanitized]
      	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
      	at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1727)
      	at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1704)
      	at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1467)
      	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1424)
      	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1394)
      	at org.elasticsearch.client.IndicesClient.create(IndicesClient.java:163)
      	at com.liferay.portal.search.elasticsearch7.internal.index.CompanyIndexFactory.createIndex(CompanyIndexFactory.java:151)
      	at com.liferay.portal.search.elasticsearch7.internal.index.CompanyIndexFactory.createIndices(CompanyIndexFactory.java:78)
      	at com.liferay.portal.search.elasticsearch7.internal.ElasticsearchSearchEngine.initialize(ElasticsearchSearchEngine.java:114)
      	at com.liferay.portal.kernel.search.SearchEngineProxyWrapper.initialize(SearchEngineProxyWrapper.java:59)
      	at com.liferay.portal.search.internal.SearchEngineHelperImpl.initialize(SearchEngineHelperImpl.java:207)
      	at com.liferay.portal.kernel.search.SearchEngineHelperUtil.initialize(SearchEngineHelperUtil.java:83)
      	at com.liferay.portal.search.internal.SearchEngineInitializer.doReIndex(SearchEngineInitializer.java:125)
      	at com.liferay.portal.search.internal.SearchEngineInitializer.reindex(SearchEngineInitializer.java:80)
      	at com.liferay.portal.search.internal.SearchEngineInitializer.reindex(SearchEngineInitializer.java:76)
      	at com.liferay.portal.search.internal.background.task.ReindexPortalBackgroundTaskExecutor.reindex(ReindexPortalBackgroundTaskExecutor.java:70)
      	at com.liferay.portal.search.internal.background.task.ReindexBackgroundTaskExecutor.execute(ReindexBackgroundTaskExecutor.java:54)
      	at com.liferay.portal.background.task.internal.SerialBackgroundTaskExecutor.execute(SerialBackgroundTaskExecutor.java:62)
      	at com.liferay.portal.kernel.backgroundtask.DelegatingBackgroundTaskExecutor.execute(DelegatingBackgroundTaskExecutor.java:41)
      	at com.liferay.portal.background.task.internal.ThreadLocalAwareBackgroundTaskExecutor.execute(ThreadLocalAwareBackgroundTaskExecutor.java:72)
      	at com.liferay.portal.background.task.internal.messaging.BackgroundTaskMessageListener.doReceive(BackgroundTaskMessageListener.java:136)
      	at com.liferay.portal.kernel.messaging.BaseMessageListener.doReceive(BaseMessageListener.java:48)
      	at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:34)
      	at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
      	at com.liferay.portal.messaging.internal.ParallelDestination$1.run(ParallelDestination.java:56)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: ElasticsearchException[Elasticsearch exception [type=json_parse_exception, reason=Unrecognized character escape 'w' (code 119)_ at [Source: [email protected]; line: 94, column: 26]]] [Sanitized]
      	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:491)
      	at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:402)
      	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:432)
      	at org.elasticsearch.ElasticsearchException.failureFromXContent(ElasticsearchException.java:598)
      	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:169)
      	... 28 more
      2020-09-01 13:20:49.654 ERROR [liferay/background_task-2][SearchEngineInitializer:184] Error encountered while reindexing
      ElasticsearchStatusException[Elasticsearch exception [type=parse_exception, reason=Failed to parse content to map]]; nested: ElasticsearchException[Elasticsearch exception [type=json_parse_exception, reason=Unrecognized character escape 'w' (code 119)_ at [Source: [email protected]; line: 94, column: 26]]]; [Sanitized]
      	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
      	at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1727)
      	at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1704)
      	at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1467)
      	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1424)
      	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1394)
      	at org.elasticsearch.client.IndicesClient.create(IndicesClient.java:163)
      	at com.liferay.portal.search.elasticsearch7.internal.index.CompanyIndexFactory.createIndex(CompanyIndexFactory.java:151)
      	at com.liferay.portal.search.elasticsearch7.internal.index.CompanyIndexFactory.createIndices(CompanyIndexFactory.java:78)
      	at com.liferay.portal.search.elasticsearch7.internal.ElasticsearchSearchEngine.initialize(ElasticsearchSearchEngine.java:114)
      	at com.liferay.portal.kernel.search.SearchEngineProxyWrapper.initialize(SearchEngineProxyWrapper.java:59)
      	at com.liferay.portal.search.internal.SearchEngineHelperImpl.initialize(SearchEngineHelperImpl.java:207)
      	at com.liferay.portal.kernel.search.SearchEngineHelperUtil.initialize(SearchEngineHelperUtil.java:83)
      	at com.liferay.portal.search.internal.SearchEngineInitializer.doReIndex(SearchEngineInitializer.java:125)
      	at com.liferay.portal.search.internal.SearchEngineInitializer.reindex(SearchEngineInitializer.java:80)
      	at com.liferay.portal.search.internal.SearchEngineInitializer.reindex(SearchEngineInitializer.java:76)
      	at com.liferay.portal.search.internal.background.task.ReindexPortalBackgroundTaskExecutor.reindex(ReindexPortalBackgroundTaskExecutor.java:70)
      	at com.liferay.portal.search.internal.background.task.ReindexBackgroundTaskExecutor.execute(ReindexBackgroundTaskExecutor.java:54)
      	at com.liferay.portal.background.task.internal.SerialBackgroundTaskExecutor.execute(SerialBackgroundTaskExecutor.java:62)
      	at com.liferay.portal.kernel.backgroundtask.DelegatingBackgroundTaskExecutor.execute(DelegatingBackgroundTaskExecutor.java:41)
      	at com.liferay.portal.background.task.internal.ThreadLocalAwareBackgroundTaskExecutor.execute(ThreadLocalAwareBackgroundTaskExecutor.java:72)
      	at com.liferay.portal.background.task.internal.messaging.BackgroundTaskMessageListener.doReceive(BackgroundTaskMessageListener.java:136)
      	at com.liferay.portal.kernel.messaging.BaseMessageListener.doReceive(BaseMessageListener.java:48)
      	at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:34)
      	at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
      	at com.liferay.portal.messaging.internal.ParallelDestination$1.run(ParallelDestination.java:56)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: ElasticsearchException[Elasticsearch exception [type=json_parse_exception, reason=Unrecognized character escape 'w' (code 119)_ at [Source: [email protected]; line: 94, column: 26]]] [Sanitized]
      	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:491)
      	at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:402)
      	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:432)
      	at org.elasticsearch.ElasticsearchException.failureFromXContent(ElasticsearchException.java:598)
      	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:169)
      	... 28 more
      
      1. The variant with a single slash is problematic as well. Three slashes \\\w doesn't produce error, but not sure if it works as expected.

       
      This worked fine in 7.2.0.

      The Search has default settings (i.e. it runs in EMBEDDED mode).

        Attachments

          Activity

            People

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            honyk Jan Tošovský
            Participants of an Issue:
            Recent user:
            Jan Tošovský
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              1 year, 3 weeks, 3 days ago

                Packages

                Version Package