Uploaded image for project: 'PUBLIC - Liferay Documentation'
  1. PUBLIC - Liferay Documentation
  2. LRDOCS-6500

Overriding Template Instructions on Advanced Configuration in Search

    Details

      Description

      The original article is here: https://help.liferay.com/hc/en-us/articles/360017896832-Advanced-Configuration-of-the-Liferay-Elasticsearch-Connector-

      Here's an example of a dynamic template that uses the analysis configuration above to analyze all string fields that end with _ja.

      {
       "LiferayDocumentType": {
       "dynamic_templates": [
       {
       "template_ja": {
       "mapping": \{
       "analyzer": "kuromoji_liferay_custom",
       "index": "analyzed",
       "store": "true",
       "term_vector": "with_positions_offsets",
       "type": "string"
       },
       "match": "\\w+_ja\\b|_
      _w+_ja_[A-Z]
      
      {2}

      b",

       "match_mapping_type": "string",
       "match_pattern": "regex"
       }
       }
       ]
       }
       }
      

      The above code adds a new template_ja dynamic template. This overrides the existing dynamic template with the same name. As with dynamic templates, you can add sub-field mappings to Liferay DXP's type mapping. These are referred to as properties in Elasticsearch.

      Since it's overriding an existing template, the above code needs to go to overrideTypeMappings. But overrideTypeMappings must include all the default mappings as well as the one to override (see paragraph below). The current explanation might be misleading or confusing. Any chance for improvement?

      "LiferayDocumentType": { 
       "properties": { 
       "fooName": {
       "index": "true",
       "store": "true",
       "type": "keyword"
       }
       } 
       }
       }
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Packages

                Version Package
                7.0.x
                7.1.x