From 0f4e848fa5b4a5e6fb3e8ed74ba338888e94150f Mon Sep 17 00:00:00 2001 From: Jose Javier Merchante Date: Fri, 23 Feb 2024 16:15:32 +0100 Subject: [PATCH] [raw/kitsune] Include mapping for data.metadata.value too big This commit includes the mapping for Kitsune to fix an error inserting Perceval items when the field 'data.metadata.value' is too big. Signed-off-by: Jose Javier Merchante --- grimoire_elk/raw/kitsune.py | 37 ++++++++++++++++++- .../kitsune-raw-mapping-updated.yml | 9 +++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 releases/unreleased/kitsune-raw-mapping-updated.yml diff --git a/grimoire_elk/raw/kitsune.py b/grimoire_elk/raw/kitsune.py index cc9925338..fc84a6174 100644 --- a/grimoire_elk/raw/kitsune.py +++ b/grimoire_elk/raw/kitsune.py @@ -20,9 +20,44 @@ # from .elastic import ElasticOcean +from grimoire_elk.elastic_mapping import Mapping as BaseMapping + + +class Mapping(BaseMapping): + + @staticmethod + def get_elastic_mappings(es_major): + """Get Elasticsearch mapping. + + :param es_major: major version of Elasticsearch, as string + :returns: dictionary with a key, 'items', with the mapping + """ + + mapping = ''' + { + "dynamic":true, + "properties": { + "data": { + "properties": { + "metadata": { + "dynamic":false, + "properties": { + "value": { + "type": "text", + "index": true + } + } + } + } + } + } + } + ''' + + return {"items": mapping} class KitsuneOcean(ElasticOcean): """Kitsune Ocean feeder""" - pass + mapping = Mapping diff --git a/releases/unreleased/kitsune-raw-mapping-updated.yml b/releases/unreleased/kitsune-raw-mapping-updated.yml new file mode 100644 index 000000000..6bec9867c --- /dev/null +++ b/releases/unreleased/kitsune-raw-mapping-updated.yml @@ -0,0 +1,9 @@ +--- +title: Kitsune raw mapping updated +category: added +author: Jose Javier Merchante +issue: null +notes: > + Update the mapping for Kitsune backend to fix an error + inserting Perceval items in the raw index when the field + 'data.metadata.value' is too big.