User-Search not working correctly, "Email address 'x' is already used for another user"

Infos:

  • Used Zammad version: 6.5.2-1759844307.de85e4a5.noble
  • Used Zammad installation type: Package
  • Operating system: Ubuntu 24.04.3 LTS
  • Browser + version: Edge

Hi there,

we had some problems shown under “System” → “Monitoring”. To solve them, we had do rebuild the elasticsearch search-index (sudo zammad run rake zammad:searchindex:rebuild).

The Errors under Monitoring disappeared, but now we have some other problems: Some users are missing under Admin → Users. Internal users, that did not logged in to the ticket system since the rebuild are not listed. They also don’t get synced via LDAP. If they sign in via Microsoft 365, they will be “re-linked”.

That’s not the main problem and should solve over time by the user logins or receiving tickets from users.

Our agents use the ticket system to communicate with external people or addresses. In the past, they could use the auto-fill/auto-search feature in the To-Field of a ticket. For example, they type “inv” and get a list of Mail-Adresses, which start with “inv”. Actual, thats not the case. If they type in the eMail-address by hand and send a ticket/mail to them, the address is not “saved” for the next time - they have to manually type them again.

Now i tried to create a user “invoices@xxx.de”, so that the auto fill for frequent used addresses would work again; but i get a error:
“Email address ‘invoices@xxx.de’ is already used for another user”

If i search for this address in the user database, i dont find any match. So there are tickets, addressed to this eMail stored - but the link between the user, the email-address and the ticket seems do be broken. I don’t think, that we will receive a email from this address (i’m sure, Zammad would re-link/re-create the user in this case) so i need a workaround/fix to do it manually.

Has anynone an idea, how i can fix that?

Thanks in advance,
Bastian

I’m pretty sure that there is a user with the email, maybe your elasticsearch is not up-to-date. Try this on the console:

root> zammad run rails r "pp User.find_by(email: 'invoices@xxx.de'.downcase.strip)"

Hello Rolf,
yes, i’m also sure that there is a user :slight_smile:

service_xxx@srz-zammad:~$ sudo zammad run rails r "pp User.find_by(email: 'invoices@xxx.de'.downcase.strip)"
#<User:0x0000734b6f681220
 id: 365,
 organization_id: nil,
 login: "invoices@xxx.de",
 firstname: "Invoices",
 lastname: "xxx",
 email: "invoices@xxx.de",
 image: nil,
 image_source: nil,
 web: "",
 password: nil,
 phone: "",
 fax: "",
 mobile: "",
 department: "",
 street: "",
 zip: "",
 city: "",
 country: "",
 address: nil,
 vip: false,
 verified: false,
 active: true,
 note: "",
 last_login: nil,
 source: nil,
 login_failed: 0,
 out_of_office: false,
 out_of_office_start_at: nil,
 out_of_office_end_at: nil,
 out_of_office_replacement_id: nil,
 preferences: {"locale"=>"de-de", "tickets_closed"=>3, "tickets_open"=>0},
 updated_by_id: 1,
 created_by_id: 105,
 created_at: "2023-06-27 09:07:01.600000000 +0000",
 updated_at: "2023-12-11 07:57:50.636000000 +0000",
 title: "",
 physicaldeliveryofficename: "">

What can i do, if the elasticsearch is not up-to-date? I thought, to recreate the searchindex would be the solution for this case of problems?

Thanks in advance,
Bastian

can you be more specific where in zammad do you not find the user by his email address? Normally after the rebuild of the search index you should be able to find the user in global search, ticket creation and admin user interface:

Wasn‘t the ES Backend removed from the user management and changed to a db based lookup? At least that‘s what I remember.

When a search query is used, then ES is called. If it is only conditions like via API parameters, without search query, then DB is called. In this case it is ES related.

1 Like

Hi,
if i search in the upper left corner for the eMail address, i only find the ticket, where a colleague asked, why this eMail-Address is not resolved in the auto fill - i don’t find the user:

If i search under Admin - Users, i don’t find any local user:

And if i try to add this user, i get the message, that the user exists already (see screenshot in the first post).

  1. check if ES is connected

root> zammad run rails r "pp Setting.get('es_url')"

  1. maybe there was an error on reindexing the user? try manually again:
root> zammad run rails c
rails> User.find_by(email: 'invoices@xxx.de'.downcase.strip).search_index_update_backend

and share the output here.

EDIT Note: For retesting in the search please reload your browser first (caches).

Hi Rolf,
here’s the output:

service_xxx@srz-zammad:~$ sudo zammad run rails r "pp Setting.get('es_url')"
"http://localhost:9200"

And this one:

service_xxx@srz-zammad:~$ sudo zammad run rails c
Loading production environment (Rails 7.2.2.2)
[1] pry(main)> User.find_by(email: 'invoices@xxx.de'.downcase.strip).search_index_update_backend
=> true
  1. was there no output about the request? was it ending with status 200 ? If not maybe open the log in a separate terminal, there should be a request if you execute the rails command:

tail -f /opt/zammad/log/production.log

  1. can you see the user now after refresh?

  2. what elasticsearch version do you have?

Hello Rolf,
i’m sorry; i misunderstood your last message.

After the “search_index_update_backend”-Command and a refresh of Zammad, i can find the user in the search bar:

Is it possible to refresh all users in the search index?

maybe your last run crashed, please run this and observe the log in the meanwhile for errors:

root> zammad run rake zammad:searchindex:rebuild

maybe use this tail this time:

zammad> tail -f /opt/zammad/log/production.log | grep ERROR -A10

Hello Rolf,

i recreated the search index again - without (relevant) errors.
We will check the next days, if we have further problems with missing users.
As i find now more “invoice*”-Addresses in the search bar, i think, the problem is solved.

If that’s not the case, i will update this post.

Thanks in advance!

1 Like

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