There should be a wrapper command for instances, with (at least) the ability to trigger index rebuilds on Elasticsearch.
Created attachment 68091 [details] [review] Bug 19462: Add a koha-elasticsearch command This patch adds a new command to be used for Elasticsearch-related tasks. The current implementation only offers the --rebuild action switch, that allows reindexing Elasticsearch on a per-instance basis as we are used to with the rest of the koha-* commands. Other options could be added in a future: --status (ES server status report, etc). To test: - Apply the whole patchset - Have a suitable Koha+Elasticsearch setup [1] - Run: $ reset_all - Run: $ man koha-elasticsearch => SUCCESS: A pretty man page is displayed covering all options - Run: $ sudo koha-elasticsearch blah => SUCCESS: The script fails because blah is not a valid instance name - Run: $ sudo koha-elasticsearch -v kohadev => SUCCESS: Reindex happens! - Try the -a, -b and -c option switches - Sign off happily :-D Sponsored-by: ByWater Solutions [1] This is straightforward if you are using KohaDevBox and created the box using: $ KOHA_ELASTICSEARCH=1 vagrant up Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 68092 [details] [review] Bug 19462: Add koha-elasticsearch documentation Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 68118 [details] [review] Bug 19462: Add a koha-elasticsearch command This patch adds a new command to be used for Elasticsearch-related tasks. The current implementation only offers the --rebuild action switch, that allows reindexing Elasticsearch on a per-instance basis as we are used to with the rest of the koha-* commands. Other options could be added in a future: --status (ES server status report, etc). To test: - Apply the whole patchset - Have a suitable Koha+Elasticsearch setup [1] - Run: $ reset_all - Run: $ man koha-elasticsearch => SUCCESS: A pretty man page is displayed covering all options - Run: $ sudo koha-elasticsearch blah => SUCCESS: The script fails because blah is not a valid instance name - Run: $ sudo koha-elasticsearch -v kohadev => SUCCESS: Reindex happens! - Try the -a, -b and -c option switches - Sign off happily :-D Sponsored-by: ByWater Solutions [1] This is straightforward if you are using KohaDevBox and created the box using: $ KOHA_ELASTICSEARCH=1 vagrant up Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Created attachment 68119 [details] [review] Bug 19462: Add koha-elasticsearch documentation Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
After getting ES to work, and adjusting my expectations of searches, this runs minimally well. It could be polished on edge error cases, but nothing that merits a Failed QA in my opinion. For example, try a "-c=2" instead of a "-c 2". Ugliness ensues.
(In reply to M. Tompsett from comment #5) > After getting ES to work, and adjusting my expectations of searches, this > runs minimally well. It could be polished on edge error cases, but nothing > that merits a Failed QA in my opinion. > > For example, try a "-c=2" instead of a "-c 2". Ugliness ensues. Are we supposed to support -c=2?
Created attachment 68617 [details] [review] Bug 19462: Add a koha-elasticsearch command This patch adds a new command to be used for Elasticsearch-related tasks. The current implementation only offers the --rebuild action switch, that allows reindexing Elasticsearch on a per-instance basis as we are used to with the rest of the koha-* commands. Other options could be added in a future: --status (ES server status report, etc). To test: - Apply the whole patchset - Have a suitable Koha+Elasticsearch setup [1] - Run: $ reset_all - Run: $ man koha-elasticsearch => SUCCESS: A pretty man page is displayed covering all options - Run: $ sudo koha-elasticsearch blah => SUCCESS: The script fails because blah is not a valid instance name - Run: $ sudo koha-elasticsearch -v kohadev => SUCCESS: Reindex happens! - Try the -a, -b and -c option switches - Sign off happily :-D Sponsored-by: ByWater Solutions [1] This is straightforward if you are using KohaDevBox and created the box using: $ KOHA_ELASTICSEARCH=1 vagrant up Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 68618 [details] [review] Bug 19462: Add koha-elasticsearch documentation Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
More options can be added in the future, but this will ease testing and is a great start
(In reply to Tomás Cohen Arazi from comment #6) > (In reply to M. Tompsett from comment #5) > > For example, try a "-c=2" instead of a "-c 2". Ugliness ensues. > > Are we supposed to support -c=2? Not expressly. But sometimes, some scripts are that format, and sometimes they are not. I'm not sure which is the officially preferred way for scripts in general, but I thought I would mention it as a valid weakness, since for some strange reason I typed that instead of what was expected and documented.
(In reply to M. Tompsett from comment #10) > (In reply to Tomás Cohen Arazi from comment #6) > > (In reply to M. Tompsett from comment #5) > > > For example, try a "-c=2" instead of a "-c 2". Ugliness ensues. > > > > Are we supposed to support -c=2? > > Not expressly. But sometimes, some scripts are that format, and sometimes > they are not. I'm not sure which is the officially preferred way for scripts > in general, but I thought I would mention it as a valid weakness, since for > some strange reason I typed that instead of what was expected and documented. I don't think we should take care of non-documented ways of passing parameters. Either the manpage or the --help switch propose that syntax. I don't even think we should support multiple ways of passing the parameters, as it tends to this: confussion.
Pushed to master for 17.11, thanks to everybody involved!