Skip to content

Swedish language (swe) missing from Elasticsearch index mapping template records.json #9243

Description

@matself

Describe the bug

When the UI language is switched to Swedish (swe), an error message is immediately displayed on the search page: "Frågan returnerade ett fel. Undersök loggar för mer information." Investigation revealed that swe is registered as a supported UI language in CatController.js but is entirely absent from the Elasticsearch index mapping template records.json. All other supported languages (eng, fre, ger, dut, dan, ita, spa) have explicit field definitions in that file. Swedish does not, causing Elasticsearch to fall back to dynamic mapping for langswe fields, which results in a 400 error when facet aggregations are attempted on those fields.

To Reproduce

  1. Enable Swedish (swe) as a UI language
  2. Open the catalogue search page in any working language
  3. Switch the UI language to Swedish using the language switcher
  4. Observe the error message on the search page

Expected behavior

The search page should load normally in Swedish, with facet aggregations working correctly, as they do for all other supported languages.

Screenshots

(pink error box screenshot attached)

Log file

Elasticsearch returns HTTP 400 with:

illegal_argument_exception: Text fields are not optimised for operations 
that require per-document field data like aggregations and sorting. 
Please use a keyword field instead. Alternatively, set fielddata=true 
on [tag.langswe].

Desktop:

  • Browser: Firefox
  • GeoNetwork Version: 4.4.x
  • Server Application: Tomcat 9 with Java 17, Elasticsearch 8.x

Additional context

The fix is to add langswe to all relevant sections of records.json, mirroring the pattern used for other languages, and rebuild the index. Other languages supported in CatController.js but absent from records.json may be affected by the same issue.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    index structure changeIndicate that this work introduces an index change.

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions