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

Override Type Mappings fails due to wrong escaping sequence saved by System Settings

    Details

    • Branch Version/s:
      7.3.x, 7.2.x, 7.1.x
    • Backported to Branch:
      Committed

      Description

      1. Copy the default mapping from source: https://github.com/liferay/liferay-portal/blob/master/modules/apps/portal-search-elasticsearch7/portal-search-elasticsearch7-impl/src/main/resources/META-INF/mappings/liferay-type-mappings.json
      2. Start remote ES 7.9.x
      3. Configure the ES7 connector to connect to remote ES:
        osgi/configs/com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config
        operationMode="REMOTE"
        productionModeEnabled=B"true"
        
      4. Start Liferay
      5. Go to System Settings > Elasticsearch 7
      6. Put the whole JSON under the Override Type Mappings field & save
      7. Hit a reindex
        Check the content of the .config file:
        overrideTypeMappings = "\{\n\t\"LiferayDocumentType\":\ \{\n\t\t\"date_detection\":\ false,\n\t\t\"dynamic_templates\":\ [\n\t\t\t\{\n\t\t\t\t\"template_ddmFieldArray_ddmFieldValue_Number_sortable\":\ \{\n\t\t\t\t\t\"mapping\":\ \{\n\t\t\t\t\t\t\"scaling_factor\":\ 1000,\n\t\t\t\t\t\t\"store\":\ true,\n\t\t\t\t\t\t\"type\":\ \"scaled_float\"\n\t\t\t\t\t\},\n\t\t\t\t\t\"path_match\":\ \"ddmFieldArray.ddmFieldValue*Number_sortable\"\n\t\t\t\t\}\n\t\t\t\},\n\t\t\t\{\n\t\t\t\t\"template_long_sortable\":\ \{\n\t\t\t\t\t\"mapping\":\ \{\n\t\t\t\t\t\t\"store\":\ true,\n\t\t\t\t\t\t\"type\":\ \"long\"\n\t\t\t\t\t\},\n\t\t\t\t\t\"match\":\ \"*_sortable\",\n\t\t\t\t\t\"match_mapping_type\":\ \"long\"\n\t\t\t\t\}\n\t\t\t\},\n\t\t\t\{\n\t\t\t\t\"template_string_sortable\":\ \{\n\t\t\t\t\t\"mapping\":\ \{\n\t\t\t\t\t\t\"store\":\ true,\n\t\t\t\t\t\t\"type\":\ \"keyword\"\n\t\t\t\t\t\},\n\t\t\t\t\t\"match\":\ \"*_sortable\",\n\t\t\t\t\t\"match_mapping_type\":\ \"string\"\n\t\t\t\t\}\n\t\t\t\},\n\t\t\t\{\n\t\t\t\t\"template_geolocation\":\ \{\n\t\t\t\t\t\"mapping\":\ \{\n\t\t\t\t\t\t\"fields\":\ \{\n\t\t\t\t\t\t\t\"geopoint\":\ \{\n\t\t\t\t\t\t\t\t\"store\":\ true,\n\t\t\t\t\t\t\t\t\"type\":\ \"keyword\"\n\t\t\t\t\t\t\t\}\n\t\t\t\t\t\t\},\n\t\t\t\t\t\t\"store\":\ true,\n\t\t\t\t\t\t\"type\":\ \"geo_point\"\n\t\t\t\t\t\},\n\t\t\t\t\t\"match\":\ \"*_geolocation\"\n\t\t\t\t\}\n\t\t\t\},\n\t\t\t\{\n\t\t\t\t\"template_ddmFieldArray_ddmFieldValueKeyword\":\ \{\n\t\t\t\t\t\"mapping\":\ \{\n\t\t\t\t\t\t\"store\":\ true,\n\t\t\t\t\t\t\"type\":\ \"keyword\"\n\t\t\t\t\t\},\n\
        
      8. Hit a reindex again
        Result
      Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized character escape 'w' (code 119)_ at [Source: (org.elasticsearch.common.bytes.AbstractBytesReference$MarkSupportingStreamInputWrapper); line: 93, column: 18] [Sanitized]

      So I decided to be brave and take the default mapping, replace all
      by \\\\.

      And then it worked.

      In my opinion this is a bug and should be fixed. I should be able to simply take the default mapping from either Elastic or the source and should not cause any issue.

       

        Attachments

          Activity

            People

            Assignee:
            sharry.shi Sharry Shi
            Reporter:
            jan.verweij Jan Verweij
            Participants of an Issue:
            Recent user:
            Enterprise Release HU
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              16 weeks, 4 days ago

                Packages

                Version Package
                7.1.X
                7.2.X
                7.3.X
                Master