Bug 25873: Ignore malformed data for Elasticsearch integer fields
authorJulian Maurice <julian.maurice@biblibre.com>
Thu, 25 Jun 2020 07:25:41 +0000 (11:25 +0400)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 31 Jul 2020 13:07:42 +0000 (15:07 +0200)
If we try to put malformed data into an integer field, Elasticsearch
rejects the whole document.
Setting 'ignore_malformed' to true allows to ignore malformed data and
process the other fields of the document normally

https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ignore-malformed.html

Test plan:
* Without the patch
  1. In search engine configuration, change the type of a text field to
  'Number' (for instance 'title')
  2. misc/search_tools/rebuild_elasticsearch.pl -d -b
  3. See that the index is empty (unless you have titles consisting only
  of digits)
* With the patch
  1. misc/search_tools/rebuild_elasticsearch.pl -d -b
  2. Now records are correctly indexed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

admin/searchengine/elasticsearch/field_config.yaml

index 8723a07..82793ff 100644 (file)
@@ -24,6 +24,7 @@ search:
   integer:
     type: integer
     null_value: 0
+    ignore_malformed: true
   stdno:
     type: text
     analyzer: analyzer_stdno