diff --git a/swh/search/elasticsearch.py b/swh/search/elasticsearch.py --- a/swh/search/elasticsearch.py +++ b/swh/search/elasticsearch.py @@ -48,7 +48,25 @@ "path_match": "intrinsic_metadata.*", "mapping": {"type": "keyword"}, } - } + }, + { + "floats_as_string": { + # All fields stored as string in the metadata + # even the floats + "match_mapping_type": "double", + "path_match": "intrinsic_metadata.*", + "mapping": {"type": "text"}, + } + }, + { + "longs_as_string": { + # All fields stored as string in the metadata + # even the longs + "match_mapping_type": "long", + "path_match": "intrinsic_metadata.*", + "mapping": {"type": "text"}, + } + }, ], "date_detection": False, "properties": { diff --git a/swh/search/tests/test_search.py b/swh/search/tests/test_search.py --- a/swh/search/tests/test_search.py +++ b/swh/search/tests/test_search.py @@ -1030,8 +1030,10 @@ "intrinsic_metadata": { "@context": "https://doi.org/10.5063/schema/codemeta-2.0", "dateCreated": "2021-02-18T10:16:52", - "version": "1.0", + "version": 1.0, + "softwareVersion": "1.0", "isAccessibleForFree": True, + "copyrightYear": 2022, }, } ] @@ -1046,7 +1048,9 @@ "dateCreated": "a long time ago", "address": "in a galaxy far, far away", "version": "a new hope", + "softwareVersion": "a new hope", "isAccessibleForFree": "it depends", + "copyrightYear": "foo bar", }, }, ]