Bug 38386 - compare_es_to_db.pl shouldn't retrieve the records from ES
Summary: compare_es_to_db.pl shouldn't retrieve the records from ES
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on: 22831
Blocks:
  Show dependency treegraph
 
Reported: 2024-11-07 11:13 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2024-11-15 13:56 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 38386: Make compare_es_to_db.pl not retrieve the records from ES (1.19 KB, patch)
2024-11-07 11:19 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 38386: Make compare_es_to_db.pl not retrieve the records from ES (1.24 KB, patch)
2024-11-15 13:54 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2024-11-07 11:13:59 UTC
It is possible to extract the ids for the resultset without making ES return the records (documents) themselves. This would save processing time in both ends, and memory (building a 5000 docs resultset, serializing it, and deserializing it, needs to take resources).
Comment 1 Tomás Cohen Arazi (tcohen) 2024-11-07 11:19:40 UTC
Created attachment 174115 [details] [review]
Bug 38386: Make compare_es_to_db.pl not retrieve the records from ES

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi (tcohen) 2024-11-07 11:26:36 UTC
in order to understand the difference in the behavior, you need an ES-enabled KTD:

```shell
ktd --proxy --es7 up -d
ktd --shell
```

Then compare the output of the following commands:

```shell
curl -X GET 'http://es:9200/koha_kohadev_biblios/_search?scroll=1m&size=10' -H 'Content-Type: application/json' -d'{"query":{"match_all":{}}}'
```

and

```shell
curl -X GET 'http://es:9200/koha_kohadev_biblios/_search?scroll=1m&size=10' -H 'Content-Type: application/json' -d'{"_source":false,"query":{"match_all":{}}}'
```
Comment 3 Nick Clemens (kidclamp) 2024-11-15 13:54:07 UTC
Created attachment 174583 [details] [review]
Bug 38386: Make compare_es_to_db.pl not retrieve the records from ES

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Nick Clemens (kidclamp) 2024-11-15 13:56:10 UTC
Small change, big impact, passing QA