Temporarily disable Elasticsearch

Infos:

  • Used Zammad version: 3.1
  • Used Zammad installation source: Packager.io
  • Operating system: Ubuntu 18.04.3 LTS
  • Browser + version: Chrome 77
  • Elasticsearch: 7.3.2
  • PostgreSQL: 10.10

Expected behavior:

  • OTRS Importer finishes and returns to console prompt.
  • Elasticsearch indexing can be disabled

Actual behavior:

When importing with the OTRS importer using the setting

Delayed::Worker.max_run_time = 7.days

I am seeing the import running continously until the message

> thread#3: ... no more work. appears as a result. No further action on this console.

When I disable Import mode and set sysytem_init_done to login I see the hundreds of thousands of delayed jobs. From production log I can see these are Elasticsearch indexing jobs. All as expected.

Steps to reproduce the behavior:

  • Import large OTRS System with Import::OTRS.start

Actual question

Is there a way to temporarily disable Elasticsearch during import. As I would like to perform several steps after the “raw” OTRS Import.

These include several “expensive” operations like

Ticket.where(group_id: ‘20’).each {|ticket|
ticket.tag_add(‘Office’, 1)
ticket.update(group_id: 63)
}

to move from our chaotic OTRS queue / sub /sub queue structure to a more coordinated Group and Tag structure in Zammad (I :heart_eyes_cat: it !! )as well as changing ticket owner for thousands of tickets to dedicated IT users (to circumvent the current restriction of being agent and customer at the same time) etc. All these operations trigger another elasticsearch delayed job.

My idea is to Stop Elasticsearch indexing before importing from OTRS. Do all the modification through the rails console. And then go through one clean indexing. Is this somehow possible?

Thanks Alex

Sorry for asking: but why?
The Delayed-Jobs are created by Zammad to fill the needed Searchindex in elasticsearch.

You can, however, if you insist, remove those Delayed-Jobs.
However attention:
This does remove all delayed jobs including possible communication tasks!
Do not use this in a production environment, this has the potential of loosing sendout information thus “failed” communication.

comon gimme the stuff

You can run the following to kill your delayed-jobs:

zammad run rails r 'Delayed::Job.destroy_all

If that’s too sketchy or you want to start from zero again, just don’t configure the elasticsearch index at that moment and configure it later.

(So zammad run rails r "Setting.set('es_url', '')" )

1 Like

I want to use Elastic but want to prevent it indexing “wrong” in the beginning. Essentially I am touching every ticket with the “cleanup” after import. So I suspect it would reindex every ticket at least twice.

Thanks for your answer I will use the empty es_url first and configure it afterwards.
I supspect I would need to run an

zammad run rake searchindex:rebuild

After setting the correct URL again to enable Elastic and index all the old stuff, correct?

1 Like

Correct!
You would need to do that do create a clean index as well :slight_smile:

Edit: the above command always re-creates the index

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.