[Bug 22994] New: Elasticsearch ability import mappings and facets settings
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Bug ID: 22994 Summary: Elasticsearch ability import mappings and facets settings Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Searching - Elasticsearch Assignee: koha-bugs@lists.koha-community.org Reporter: black23@gmail.com Target Milestone: --- -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Michal Denar <black23@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |22639 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22639 [Bug 22639] Elasticsearch ability export mappings and facets settings -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Michal Denar <black23@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |axel.amghar@biblibre.com, | |black23@gmail.com, | |ere.maijala@helsinki.fi, | |josef.moravec@gmail.com, | |katrin.fischer@bsz-bw.de, | |marjorie.barry-vila@collect | |o.ca -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Michal Denar <black23@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|22639 | Depends on| |22639 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22639 [Bug 22639] Elasticsearch ability export mappings and facets settings -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Michal Denar <black23@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |22639 Depends on|22639 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22639 [Bug 22639] Elasticsearch ability export mappings and facets settings -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 axel Amghar <axel.amghar@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |20588 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20588 [Bug 20588] Elasticsearch - Apply dataTable on search fields and mapping tables -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #1 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- *** This bug has been marked as a duplicate of bug 22639 *** -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Bug 22994 depends on bug 20588, which changed state. Bug 20588 Summary: Elasticsearch - Apply dataTable on search fields and mapping tables https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20588 What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |RESOLVED Resolution|--- |DUPLICATE -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | Resolution|DUPLICATE |--- CC| |tomascohen@gmail.com --- Comment #2 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- This is not a duplicate, but the counterpart for the other bug (i.e. export vs. import) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|22639 | Depends on| |22639 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22639 [Bug 22639] Elasticsearch ability export mappings and facets settings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 --- Comment #3 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 196022 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196022&action=edit Bug 22994: Add PUT /config/search_mappings endpoint This patch adds a PUT endpoint to import/replace search field mappings. It accepts both JSON and YAML request bodies, matching the export format from GET /config/search_mappings. The existing reset_elasticsearch_mappings method is extended to accept an optional mappings hashref, allowing reuse for both reset-to-defaults and import-from-user-data flows. To test: 1. Apply this patch (and the previous API endpoint patches) 2. Rebuild the API bundle: $ yarn api:bundle 3. Restart Plack 4. Export current mappings: $ curl -u user:pass -H 'Accept: application/yaml' \ /api/v1/config/search_mappings > mappings.yaml 5. Edit mappings.yaml (e.g. change a label) 6. Import the modified mappings: $ curl -u user:pass -X PUT \ -H 'Content-Type: application/yaml' \ --data-binary @mappings.yaml \ /api/v1/config/search_mappings => SUCCESS: Returns 200 with the imported mappings 7. Verify the changes: $ curl -u user:pass /api/v1/config/search_mappings => SUCCESS: Modified label is reflected 8. Run: $ prove t/db_dependent/api/v1/config_search_mappings.t => SUCCESS: Tests pass 9. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 --- Comment #4 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 196023 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196023&action=edit Bug 22994: Add import mappings button to mappings page This patch adds an 'Import mappings' button to the Elasticsearch mappings configuration page. Clicking it opens a modal where the user can select a YAML or JSON mappings file (as exported by the export button). The file is sent via PUT /api/v1/config/search_mappings and the page reloads to reflect the new state. To test: 1. Apply this patch (and the previous API patches) 2. Navigate to Administration > Search engine configuration => SUCCESS: An 'Import mappings' button appears next to 'Export mappings' 3. Click 'Export mappings' to get a baseline file 4. Edit the downloaded search_mappings.yaml (e.g. change a label) 5. Click 'Import mappings', select the modified file, click Import => SUCCESS: Page reloads with the updated mappings 6. Verify the change is reflected in the UI => SUCCESS: Modified label is visible 7. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 Thomas Klausner <domm@plix.at> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |domm@plix.at --- Comment #5 from Thomas Klausner <domm@plix.at> --- I guess this will overwrite the current mappings with whatever is in the file? I think it would be a lot of work, but maybe nice, to show the diff before actually changing the mappings? On the other hand, admins can download the current mappings and diff those mappings with the ones they want to upload on their machine. So we don't have to reimplement this in Koha... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196022|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196023|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 --- Comment #6 from David Nind <david@davidnind.com> --- Created attachment 197762 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197762&action=edit Bug 22994: Add PUT /config/search_mappings endpoint This patch adds a PUT endpoint to import/replace search field mappings. It accepts both JSON and YAML request bodies, matching the export format from GET /config/search_mappings. The existing reset_elasticsearch_mappings method is extended to accept an optional mappings hashref, allowing reuse for both reset-to-defaults and import-from-user-data flows. To test: 1. Apply this patch (and the previous API endpoint patches) 2. Rebuild the API bundle: $ yarn api:bundle 3. Restart Plack 4. Export current mappings: $ curl -u user:pass -H 'Accept: application/yaml' \ /api/v1/config/search_mappings > mappings.yaml 5. Edit mappings.yaml (e.g. change a label) 6. Import the modified mappings: $ curl -u user:pass -X PUT \ -H 'Content-Type: application/yaml' \ --data-binary @mappings.yaml \ /api/v1/config/search_mappings => SUCCESS: Returns 200 with the imported mappings 7. Verify the changes: $ curl -u user:pass /api/v1/config/search_mappings => SUCCESS: Modified label is reflected 8. Run: $ prove t/db_dependent/api/v1/config_search_mappings.t => SUCCESS: Tests pass 9. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 --- Comment #7 from David Nind <david@davidnind.com> --- Created attachment 197763 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197763&action=edit Bug 22994: Add import mappings button to mappings page This patch adds an 'Import mappings' button to the Elasticsearch mappings configuration page. Clicking it opens a modal where the user can select a YAML or JSON mappings file (as exported by the export button). The file is sent via PUT /api/v1/config/search_mappings and the page reloads to reflect the new state. To test: 1. Apply this patch (and the previous API patches) 2. Navigate to Administration > Search engine configuration => SUCCESS: An 'Import mappings' button appears next to 'Export mappings' 3. Click 'Export mappings' to get a baseline file 4. Edit the downloaded search_mappings.yaml (e.g. change a label) 5. Click 'Import mappings', select the modified file, click Import => SUCCESS: Page reloads with the updated mappings 6. Verify the change is reflected in the UI => SUCCESS: Modified label is visible 7. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This enhancement to search release notes| |lets you import an | |Elasticsearch mappings file | |using the staff interface | |and command line: | |- Staff interface: adds a | |new "Import mappings" | |button (Administration > | |Catalog > Search engine | |configuration | |(Elasticsearch)) | |- Command line: adds an | |option to the API to allow | |importing a mappings.yaml | |file* | | | |IMPORTANT: Importing a | |mappings.yaml file will | |overwrite the existing | |file, make sure you have a | |backup if required. | | | |* Example command to import | |a mappings.yaml file using | |the command line: | | | |curl -u koha:koha -X PUT -H | |'Content-Type: | |application/yaml' | |--data-binary | |@mappings.yaml | |http://127.0.0.1:8081/api/v | |1/config/search_mappings | | | |(Note: The ability to | |export the mappings.yaml | |file was added in Bug 22639 | |- Ability to export | |Elasticsearch mappings and | |facets settings, in Koha | |26.05.) CC| |david@davidnind.com --- Comment #8 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. curl commands that worked for me using KTD: Step 4: curl -u koha:koha -H 'Accept: application/yaml' http://127.0.0.1:8081/api/v1/config/search_mappings > mappings.yaml Step 6: curl -u koha:koha -X PUT -H 'Content-Type: application/yaml' --data-binary @mappings.yaml http://127.0.0.1:8081/api/v1/config/search_mappings Step 7: curl -u koha:koha http://127.0.0.1:8081/api/v1/config/search_mappings 2. For steps 6 and 7, I got a stream of text on the screen. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org