Bug 23137

Summary: Add a command line tool to reset elasticsearch mappings
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Searching - ElasticsearchAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P5 - low CC: 1joynelson, jonathan.druart, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23138
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.06
Circulation function:
Bug Depends on:    
Bug Blocks: 25278    
Attachments: Bug 23137: Add reset option to rebuild_elasticsearch.pl
Bug 23137: Add reset and delete to koha-elasticsearch
Bug 23137: Add reset option to rebuild_elasticsearch.pl
Bug 23137: Add reset and delete to koha-elasticsearch
Bug 23137: Add documentation
Bug 23137: Move cache flushing to the method
Bug 23137: Move cache flushing to the method
Bug 23137: Add reset option to rebuild_elasticsearch.pl
Bug 23137: Add reset and delete to koha-elasticsearch
Bug 23137: Add documentation
Bug 23137: Move cache flushing to the method

Description Nick Clemens (kidclamp) 2019-06-17 17:26:50 UTC
It would be useful to have this option from the command line

Possibly as part of koha-elasticsearch
Comment 1 Nick Clemens (kidclamp) 2020-03-19 16:45:16 UTC
Created attachment 101051 [details] [review]
Bug 23137: Add reset option to rebuild_elasticsearch.pl

Setup:
1 - Be using Elasticsearch
2 - Reload mappings from the db
    Admin->Search configuration
    Reset Mappings
3 - Reindex ES and confirm searching is working

To test:
1 - Apply patch
2 - Alter your mappings file for elastic (just change a description for a field)
3 - perl misc/search_tools/rebuild_elasticsearch.pl -r -v
    Verbose not necessary, but good for letting you know things are progressing
4 - Confirm the mapping change shows in the interface
5 - Confirm reindex worked and searching is working
Comment 2 Nick Clemens (kidclamp) 2020-03-19 16:45:18 UTC
Created attachment 101052 [details] [review]
Bug 23137: Add reset and delete to koha-elasticsearch

Same as previous test, but use the script to run the reindex
reset_all to update the scripts or use
misc4dev/cp_debian_files.pl

sudo koha-elasticsearch --rebuild -r -v
Comment 3 Andrew Fuerste-Henry 2020-04-03 12:57:34 UTC
Created attachment 102354 [details] [review]
Bug 23137: Add reset option to rebuild_elasticsearch.pl

Setup:
1 - Be using Elasticsearch
2 - Reload mappings from the db
    Admin->Search configuration
    Reset Mappings
3 - Reindex ES and confirm searching is working

To test:
1 - Apply patch
2 - Alter your mappings file for elastic (just change a description for a field)
3 - perl misc/search_tools/rebuild_elasticsearch.pl -r -v
    Verbose not necessary, but good for letting you know things are progressing
4 - Confirm the mapping change shows in the interface
5 - Confirm reindex worked and searching is working

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 4 Andrew Fuerste-Henry 2020-04-03 12:57:36 UTC
Created attachment 102355 [details] [review]
Bug 23137: Add reset and delete to koha-elasticsearch

Same as previous test, but use the script to run the reindex
reset_all to update the scripts or use
misc4dev/cp_debian_files.pl

sudo koha-elasticsearch --rebuild -r -v

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 5 Jonathan Druart 2020-04-13 12:17:22 UTC
Please add doc to debian/docs/koha-elasticsearch.xml
Comment 6 Nick Clemens (kidclamp) 2020-04-14 10:14:27 UTC
Created attachment 102918 [details] [review]
Bug 23137: Add documentation
Comment 7 Jonathan Druart 2020-04-14 10:44:12 UTC
Should not we have the cache clearing in reset_elasticsearch_mappings?
Comment 8 Jonathan Druart 2020-04-15 14:38:32 UTC
Created attachment 103014 [details] [review]
Bug 23137: Move cache flushing to the method
Comment 9 Nick Clemens (kidclamp) 2020-04-24 10:41:48 UTC
Created attachment 103640 [details] [review]
Bug 23137: Move cache flushing to the method

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Jonathan Druart 2020-04-24 11:05:44 UTC
Created attachment 103647 [details] [review]
Bug 23137: Add reset option to rebuild_elasticsearch.pl

Setup:
1 - Be using Elasticsearch
2 - Reload mappings from the db
    Admin->Search configuration
    Reset Mappings
3 - Reindex ES and confirm searching is working

To test:
1 - Apply patch
2 - Alter your mappings file for elastic (just change a description for a field)
3 - perl misc/search_tools/rebuild_elasticsearch.pl -r -v
    Verbose not necessary, but good for letting you know things are progressing
4 - Confirm the mapping change shows in the interface
5 - Confirm reindex worked and searching is working

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Jonathan Druart 2020-04-24 11:05:48 UTC
Created attachment 103648 [details] [review]
Bug 23137: Add reset and delete to koha-elasticsearch

Same as previous test, but use the script to run the reindex
reset_all to update the scripts or use
misc4dev/cp_debian_files.pl

sudo koha-elasticsearch --rebuild -r -v

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 12 Jonathan Druart 2020-04-24 11:05:51 UTC
Created attachment 103649 [details] [review]
Bug 23137: Add documentation

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 13 Jonathan Druart 2020-04-24 11:05:55 UTC
Created attachment 103650 [details] [review]
Bug 23137: Move cache flushing to the method

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 14 Martin Renvoize (ashimema) 2020-04-29 16:35:54 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 15 Joy Nelson 2020-05-08 22:49:30 UTC
backported to 19.11.x for 19.11.06
Comment 16 Lucas Gass (lukeg) 2020-05-15 15:46:45 UTC
Patchset does not apply clean to 19.05.x, no backport