Index / add Swedish (swe) to Elasticsearch records mapping#9355
Open
juanluisrp wants to merge 1 commit into
Open
Index / add Swedish (swe) to Elasticsearch records mapping#9355juanluisrp wants to merge 1 commit into
juanluisrp wants to merge 1 commit into
Conversation
Swedish was registered as a supported UI language in CatController.js but had no field definitions in the index mapping template records.json, unlike all other supported languages. Switching the UI to Swedish triggered facet aggregations on langswe fields, which Elasticsearch had created via dynamic mapping as text fields. Text fields are not optimised for aggregations, so the request failed with HTTP 400 and the search page showed an error. Add langswe to every relevant section of records.json, mirroring the existing languages: keyword for the aggregatable fields (tag, any, organisationName and their dynamic templates) and text with the built-in swedish analyzer for the full-text fields. Closes geonetwork#9243
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds Swedish (
swe) to the Elasticsearch index mapping templaterecords.json.Swedish is registered as a supported UI language in
CatController.js, but it was the only such language with no explicit field definitions inrecords.json. When the UI was switched to Swedish, facet aggregations ran againstlangswefields that Elasticsearch had created through dynamic mapping astextfields. Text fields can't be aggregated, so the request failed with HTTP 400 and the search page displayed an error:langsweis now added to every relevant section, mirroring the existing languages:keywordfor the aggregatable fields and their dynamic templates (organisationName,tag/th_*,any)textwith the built-inswedishanalyzer for the full-text fields (*Objecttemplate andany)This matches how
german,danish,italian,spanish,romanianandportugueseare handled (built-in language analyzer; onlyenglish/frenchuse custom_rebuiltanalyzers).Verification
Tested against Elasticsearch 8.19:
swedishanalyzer exists and stems/stops correctly.keyword-mappedtag.langswefield aggregates correctly.tag.langswereproduces the reported 400.textfield withanalyzer: swedishis accepted.Existing indexes need to be rebuilt for the new mapping to take effect.
Closes #9243