<<

NAME

rebuild_elasticsearch.pl - inserts records from a Koha database into Elasticsearch

SYNOPSIS

rebuild_elasticsearch.pl [-c|--commit=count] [-d|--delete] [-r|--reset] [-a|--authorities] [-b|--biblios] [--desc] [-bn|--bnumber] [-ai|--authid] [-p|--processes] [-v|--verbose] [-h|--help] [--man]

DESCRIPTION

Inserts records from a Koha database into Elasticsearch.

OPTIONS

-c|--commit=count

Specify how many records will be batched up before they're added to Elasticsearch. Higher should be faster, but will cause more RAM usage. Default is 5000.

-d|--delete

Delete the index and recreate it before indexing.

-r|--reset

Reload mappings from files (specified in koha-conf.xml) before indexing. Implies --delete.

-a|--authorities

Index the authorities only. Combining this with -b is the same as specifying neither and so both get indexed.

-b|--biblios

Index the biblios only. Combining this with -a is the same as specifying neither and so both get indexed.

--desc

Index the records in descending id order. Intended to index newer record before older records. Default is to index in ascending order. Does not work with --bnumber or --authid

-bn|--bnumber

Only index the supplied biblionumber, mostly for testing purposes. May be repeated.

-ai|--authid

Only index the supplied authority id, mostly for testing purposes. May be repeated.

-p|--processes

Number of processes to use for indexing. This can be used to do more indexing work in parallel on multicore systems. By default, a single process is used.

-v|--verbose

By default, this program only emits warnings and errors. This makes it talk more. Add more to make it even more wordy, in particular when debugging.

-h|--help

Help!

--man

Full documentation.

IMPLEMENTATION

INTERNAL METHODS

_verify_index_state

    _verify_index_state($Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX, 1);

Checks the index state and recreates it if requested.

_do_reindex

    _do_reindex($callback, $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX);

Does the actual reindexing. $callback is a function that always returns the next record. For each index we iterate through the records, committing at specified count

_sanity_check

    _sanity_check();

Checks some basic stuff to ensure that it's sane before we start.

_handle_response

Parse the return from update_index and display errors depending on verbosity of the script

_log

    _log($level, "Message\n");

Output progress information.

Will output the message if verbosity level is set to $level or more. Will not include a trailing newline automatically.

<<